Flutter 如何在没有ListTile的情况下显示图标按钮的墨迹动画';s水墨动画?

Flutter 如何在没有ListTile的情况下显示图标按钮的墨迹动画';s水墨动画?,flutter,Flutter,如果将带onPress set的IconButton设置为带onTap set的ListTile的尾部,则将同时显示IconButton ink动画和ListTile ink动画。这种行为与材料设计一样正确吗? 当我点击图标按钮时,我认为最好只显示图标按钮的墨迹动画。有什么办法吗 列表磁砖没有要修改的splashColor和highlightColor属性。您的问题的一个解决方案是从ListTile中删除onTap()函数或将其设置为null,然后用InkWell包装ListTile,并向其提供

如果将带onPress set的IconButton设置为带onTap set的ListTile的尾部,则将同时显示IconButton ink动画和ListTile ink动画。这种行为与材料设计一样正确吗? 当我点击图标按钮时,我认为最好只显示图标按钮的墨迹动画。有什么办法吗


列表磁砖
没有要修改的
splashColor
highlightColor
属性。您的问题的一个解决方案是从
ListTile
中删除
onTap()
函数或将其设置为
null
,然后用
InkWell
包装
ListTile
,并向其提供
onTap
函数。然后将其
splashColor
highlightColor
设置为
颜色。透明

  return ListView(
      children: <Widget>[
        InkWell(
          onTap: (){
            // here you add the function intended to handle ListTile tap event.
          },
          splashColor: Colors.transparent, 
          highlightColor: Colors.transparent,
          child: ListTile(
            onTap: null,
            leading: IconButton(
              icon: Icon(
                Icons.video_library,
                color: Colors.yellow,
              ),
              onPressed: (){},
              splashColor: Colors.cyan,
            ),
            title: Text('Item'),
          ),
        ),
      ],
    );
返回列表视图(
儿童:[
墨水池(
onTap:(){
//这里添加了用于处理ListTile点击事件的函数。
},
splashColor:Colors.transparent,
highlightColor:Colors.transparent,
孩子:ListTile(
onTap:null,
领先:IconButton(
图标:图标(
Icons.video_库,
颜色:颜色,黄色,
),
按下:(){},
splashColor:Colors.cyan,
),
标题:文本(“项目”),
),
),
],
);

ListTile
没有要修改的
splashColor
highlightColor
属性。您的问题的一个解决方案是从
ListTile
中删除
onTap()
函数或将其设置为
null
,然后用
InkWell
包装
ListTile
,并向其提供
onTap
函数。然后将其
splashColor
highlightColor
设置为
颜色。透明

  return ListView(
      children: <Widget>[
        InkWell(
          onTap: (){
            // here you add the function intended to handle ListTile tap event.
          },
          splashColor: Colors.transparent, 
          highlightColor: Colors.transparent,
          child: ListTile(
            onTap: null,
            leading: IconButton(
              icon: Icon(
                Icons.video_library,
                color: Colors.yellow,
              ),
              onPressed: (){},
              splashColor: Colors.cyan,
            ),
            title: Text('Item'),
          ),
        ),
      ],
    );
返回列表视图(
儿童:[
墨水池(
onTap:(){
//这里添加了用于处理ListTile点击事件的函数。
},
splashColor:Colors.transparent,
highlightColor:Colors.transparent,
孩子:ListTile(
onTap:null,
领先:IconButton(
图标:图标(
Icons.video_库,
颜色:颜色,黄色,
),
按下:(){},
splashColor:Colors.cyan,
),
标题:文本(“项目”),
),
),
],
);

我也有类似的问题。我找到了使用堆栈的解决方法:

返回堆栈(
对齐:alignment.centerRight,
儿童:[
列表砖(
标题:文本(“标题”),
),
填充物(
填充:仅限边缘设置(右:8),
孩子:我的钮扣(
子:图标(Icons.close),
按下:(){},
iconSize:16,
),
),
],
);``

我也有类似的问题。我找到了使用堆栈的解决方法:

返回堆栈(
对齐:alignment.centerRight,
儿童:[
列表砖(
标题:文本(“标题”),
),
填充物(
填充:仅限边缘设置(右:8),
孩子:我的钮扣(
子:图标(Icons.close),
按下:(){},
iconSize:16,
),
),
],
);``