Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove default padding from ExpansionTile's header

Tags:

flutter

dart

By default we have 16 horizontal paddings in ExpansionTile's header, because it is ListTile and it has

/// If null, `EdgeInsets.symmetric(horizontal: 16.0)` is used.
    final EdgeInsetsGeometry contentPadding;

So we have spaces on left and right enter image description here

How to remove them?

like image 270
Kirill Matrosov Avatar asked Feb 15 '19 18:02

Kirill Matrosov


People also ask

How do you remove padding between title and leading in flutter?

Default value is 40 , so to reduce space between leading and title by x pass minLeadingWidth: 40 - x .

What is default padding in flutter?

It defaults to 8.0 padding on all sides.

How do you use Expansiontile in flutter?

You need to implement it in your code respectively: Create a new dart file called expansion_title_demo. dart inside the lib folder. In this screen, we will create a list with the help of a list view builder in which the expansion tile widget will be used and initialize the list data into the expansion tile widget.


1 Answers

The chosen answer is not working fully. In order to get it right you should go :

ListTileTheme(
   contentPadding: EdgeInsets.all(0),
   dense: true,
   horizontalTitleGap: 0.0,
   minLeadingWidth: 0,
   child: ExpansionTile(...)
)
like image 67
Hallel Avatar answered Oct 16 '22 11:10

Hallel