【发布时间】:2020-09-05 06:04:24
【问题描述】:
增加 GestureDetector 区域的最佳方法是什么?
我想避免使用自定义宽度和高度的容器
我在这一行有一张卡片:
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new IconButton(
icon: new Icon(
Icons.remove,
color: Colors.white,
),
onPressed: () => { _decreaseCounter() },
),
GestureDetector(
child: Text(
_counter.toString(),
style: new TextStyle(
color: Colors.white,
fontSize: 18.0,
fontWeight: FontWeight.bold),
),
onTap: () => _openDialog(),
),
new IconButton(
icon: new Icon(
Icons.add,
color: Colors.white,
),
onPressed: () => { _increaseCounter()},
)
当我点击文本时,它应该会打开一个对话框,但是 GesutreDetector 区域非常小,打开对话框非常困难。所以我需要的是增加这个检测区域。
【问题讨论】:
-
您好,您能多描述一些或显示一些代码吗?事实上,你几乎可以用手势检测器包裹每一种元素
-
@MarcelDz 当然,完成!
标签: flutter flutter-layout flutter-widget