【发布时间】:2020-07-05 22:28:36
【问题描述】:
我在前导属性中有 ListTile 和按钮。一切正常,但是如果按下按钮,则瓷砖 onTap 手势也会被激活。 Tile onTap 不仅仅触发动画。
这里是代码
ListTile(
contentPadding: EdgeInsets.zero,
leading: IconButton(
icon: Icon(Icons.check_circle),
onPressed: () => print('select'),
),
title: Text('TEST'),
trailing: Icon(
Icons.arrow_forward_ios,
),
onTap: () => print('on tap'),
)
关于如何摆脱前导区域的磁贴 onTap 效果的任何想法。我想到的唯一方法是使用包裹在手势检测器中的磁贴中的行并摆脱 onTap 但如果有的话我希望有更好的解决方案
【问题讨论】:
-
我认为您对此无能为力,在
ListTile中没有可以摆脱onTap影响的属性。用GestureDetector包裹它是要走的路