从列表标题和标题之间删除填充 [英] Remove padding from ListTile between leading and title

查看:57
本文介绍了从列表标题和标题之间删除填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要删除ListTile中领先的Widget和标题Widget之间的一些填充. 它有太多的空格. 有没有办法做到这一点? 我为此使用的代码是这样的:

I need to remove some padding between leading Widget and title Widget in a ListTile. It has too much blank spaces. Is there a way to do that? The code that I am using for that is this:

ListTile _getActionMenu(String text, IconData icon, Function() onTap) {
  return new ListTile(
    leading: new Icon(icon),
    title: new Text(text),
    onTap: onTap,
  );
}

推荐答案

您可以使用Align并指定Alignment.

ListTile _getActionMenu(String text, IconData icon, Function() onTap) {
  return new ListTile(
    leading: new Icon(icon),
    title: Align(
      child: new Text(text),
      alignment: Alignment(-1.2, 0),
    ),
    onTap: onTap,
  );
}

这篇关于从列表标题和标题之间删除填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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