小编Giu*_*one的帖子

增加 GestureDetector 面积的最佳方法

增加 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()},
)
Run Code Online (Sandbox Code Playgroud)

当我点击文本时,它应该打开一个对话框,但是 GesutreDetector 区域非常小,很难打开该对话框。所以我需要的是增加这个检测区域。

flutter flutter-layout flutter-widget

3
推荐指数
1
解决办法
3129
查看次数

标签 统计

flutter ×1

flutter-layout ×1

flutter-widget ×1