简体   繁体   English

如何调整 Flutter ListView Widget 内项目之间的间距

[英]How to adjust the spacing between items inside a Flutter ListView Widget

How can I decrease the spacing between trailing, title / subtile & leading items inside a ListViewTile Widget in Flutter?如何减少 Flutter 中 ListViewTile 小部件内的尾随、标题/副标题和前导项之间的间距?

列表瓷砖

visualDensity: VisualDensity.compact,

is helping a little to decrease the padding between the ListItems in the row有助于减少行中 ListItems 之间的填充

width: MediaQuery.of(context).size.width 

This will help you to solve your error.这将帮助您解决错误。 This is happening cause the subtitle is overflowing the container width.发生这种情况是因为字幕溢出了容器宽度。 So make the container width the line I above mention.因此,将容器宽度设为我上面提到的线。

Try to use Flexible Widget in your ListView items尝试在您的 ListView 项目中使用灵活的小部件

there is a new property added to the ListTile, which is doing the job: ListTile 中添加了一个新属性,它正在完成这项工作:

horizontalTitleGap: value(double),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM