The margin between leading and title is too much;
How to decrease it; I have tried several ways:
however, it does not work at all; is there any solution, i do need help
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.
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), ], ), ...
The only answer that worked for me is to Matrix transform the title widget.
Here, the title text padding is decreased by 16.
ListTile( leading: Icon(icon), title: Transform( transform: Matrix4.translationValues(-16, 0.0, 0.0), child: Text("Title text", style: TextStyle(fontSize: 18, color: textPrimary)), ), );
Source: How to set the padding between leading and title from Flutter ListTile?
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