简体   繁体   English

应用栏上的 InkWell 高度飞溅

[英]InkWell height splash on appbar

i put avatar image on appbar and i gave it inkwell for splash effect but the inkwell height cannot be change, i want to match the inkwell with image.我把头像图像放在 appbar 上,我给了它 inkwell 来实现飞溅效果,但是 inkwell 高度不能改变,我想将 inkwell 与图像匹配。 Or if you have any better approach for image ontap with splash but don't give me additional package okay或者,如果您有更好的方法来使用 splash 进行图像 ontap,但不要给我额外的 package 好吧

在此处输入图像描述

code:代码:

AppBar(
  centerTitle: false,
  elevation: 0,
  toolbarHeight: 80,
  backgroundColor: Colors.blue,
  titleSpacing: 24,
  title: Text(
    'Hello, what\'s your name? ',
    style: TextStyle(
      fontSize: 22.sp,
    ),
  ),
  actions: [
    CircleAvatar(
      radius: 30.0,
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          borderRadius: BorderRadius.circular(50),
          onTap: () {},
        ),
      ),
      backgroundImage: NetworkImage(
          "https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8N3x8cGVvcGxlfGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=500&q=60"),
      backgroundColor: Colors.transparent,
    ),
    SizedBox(width: 24),
  ],
);

you have to wrap your action with center widget and it should work fine.你必须用中心小部件包装你的动作,它应该可以正常工作。

AppBar(
  centerTitle: false,
  elevation: 0,
  toolbarHeight: 80,
  backgroundColor: Colors.blue,
  titleSpacing: 24,
  title: Text(
    'Hello, what\'s your name? ',
    style: TextStyle(
      fontSize: 22.sp,
    ),
  ),
  actions: [
Center(
child:CircleAvatar(
      radius: 30.0,
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          borderRadius: BorderRadius.circular(50),
          onTap: () {},
        ),
      ),
      backgroundImage: NetworkImage(
          "https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8N3x8cGVvcGxlfGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=500&q=60"),
      backgroundColor: Colors.transparent,
    ),),
    SizedBox(width: 24),
  ],
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM