【问题标题】:Trailing Flat buttons Overflows in ListTileListTile 中的尾随扁平按钮溢出
【发布时间】:2019-10-30 16:48:17
【问题描述】:

我有一个ListViewListTile。每个ListTile 都有一个带有Text 的标题,带有Text 的副标题,并以两个Flatbuttons 结尾为Column。但是 Flatbuttons 溢出了 ListTitle。如何确保 FlatButtons 保持在界限内?

【问题讨论】:

    标签: flutter


    【解决方案1】:

    使用扩展

      trailing: Column(
        children: <Widget>[
          Icon(Icons.keyboard_arrow_right),
          Expanded(
            child: FlatButton(
              child: Text('text'),
              onPressed: () => {},
            ),
          )
        ],
      ),
    

    【讨论】:

      【解决方案2】:

      在这种情况下你真的需要 flatbutton 还是使用 IconButton() 更好? 无论如何,请记住平面按钮的最小尺寸为 88.0 x 36.0,可以用 [ButtonTheme] 覆盖。

      还要记住,前导小部件和尾随小部件的高度是根据 Material 规范进行限制的。单行 ListTiles 可访问性例外。

      https://api.flutter.dev/flutter/material/ListTile-class.html

      例如:

      ButtonTheme(
        minWidth:60,
        height:40
        child:FlatButton(
          child:Text("HelloWorld")
        )
      )
      

      【讨论】:

        猜你喜欢
        • 2019-08-05
        • 2023-01-17
        • 1970-01-01
        • 2019-09-02
        • 2019-06-30
        • 1970-01-01
        • 1970-01-01
        • 2014-08-09
        • 1970-01-01
        相关资源
        最近更新 更多