【发布时间】:2021-08-23 17:19:38
【问题描述】:
我正在使用墨水瓶来检测水龙头。我也使用了手势检测器,但效果不佳。找到了一个解决方案,说用 IgnorePointer 包裹孩子,但效果不佳。
这是我的代码:
Positioned(
bottom: -67,
child: GestureDetector(
onTap: () {
print('Tap');
},
child: Container(
width: 70,
height: 70,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 5,
),
boxShadow: [
BoxShadow(
color:
Color(0xFF000000).withAlpha(11),
blurRadius: 16,
offset: Offset(0, 3),
),
],
shape: BoxShape.circle,
color: Colors.white,
),
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.green,
child: Icon(
Icons.arrow_forward,
color: Colors.white,
),
),
),
),
),
这是我要检测点击的按钮。
编辑:它正在检测点击,但在圆形头像的白色边框之外。我希望整个白色边框和圆形头像都是可点击的。移除定位后,整个容器都可以点击,但现在我想如何在堆栈中定位该元素!!!
【问题讨论】:
-
我试过你的代码,它工作正常。我在你的代码中唯一注意到的是,只有你的内部 onTap 方法会被触发,因为你用另一个 InkWell 包装你的 InkWill
-
尝试用 Material 包裹你的 Inkwell。
-
使用其他点击方法而不是 InkWell
-
@quoci 我想要两个圈子...怎么做?
-
@Venky 喜欢吗?还有什么?
标签: flutter dart flutter-layout