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, ); }
As Dinesh has pointed out here, ListTile has received a minLeadingWidth property. Default value is 40 , so to reduce space between leading and title by x pass minLeadingWidth: 40 - x .
You can use the visualDensity property to reduce the space. ListTile( visualDensity: VisualDensity(horizontal: 0, vertical: -4), title: Text("xyz") ); The visualDensity value can be changed from -4.0 to 4.0 . Lower the value, more compact the view.
As Dinesh has pointed out here, ListTile
has received a minLeadingWidth
property.
Default value is 40
, so to reduce space between leading and title by x
pass minLeadingWidth: 40 - x
.
Align
results will depend on text and tile width.
Use Transform.translate
for consistent results.
ListTile( leading: Icon(icon), title: Transform.translate( offset: Offset(-16, 0), child: Text('Some text'), ), );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With