Search code examples
flutterdart

How to remove default padding from ExpansionTile's header


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?


Solution

  • 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(...)
    )