如何减少ListTile的“开头”和“标题”之间的边距?扑 [英] How to reduce the margin between 'leading' and 'title' for ListTile ? Flutter

查看:695
本文介绍了如何减少ListTile的“开头”和“标题”之间的边距?扑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开头和标题之间的边距太大;

The margin between leading and title is too much;

如何减少它;
我尝试了几种方法:

How to decrease it; I have tried several ways:


  1. 用容器翘起行距并将右边距设置为负;

  2. 扭曲标题并设置padding-left

但是,它根本不起作用;
有什么解决方案,我确实需要帮助

however, it does not work at all; is there any solution, i do need help

推荐答案

您最终会更好地构建自己的容器- ListTile没什么特别的或复杂的。这样,您可以轻松自定义标题和按钮之间的间距等内容。只是使用类似这样的东西:

you're ultimately better off building your own containers - there's nothing special or complicated about ListTile. that way you can easily customize things like the spacing between a title and a button. just use something like so:

  Container(
    padding: new EdgeInsets.symmetric(vertical: 6.0, horizontal: 6.0),
    margin: EdgeInsets.symmetric(vertical: 6.0),

    decoration: BoxDecoration(
      borderRadius: BorderRadius.circular(6.0),
      border: Border.all(color: Colors.black),
    ),

    child: Column(
      children: <Widget>[
        Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[

                  IconButton(
                    icon: Icon(myLeadingIcon),
                    onPressed: () => {},
                  ),
                  Padding(padding: EdgeInsets.only(left: 20.0)),
                  Text(_myTitle),
                ],
              ),
    ...

这篇关于如何减少ListTile的“开头”和“标题”之间的边距?扑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆