Reputation: 1185
How can I reduce the vertical padding between the ExpansionTile children:
Here is the inline widget code:
Expanded(
child: ListView(
padding: EdgeInsets.all(0.0) ,
primary: true,
shrinkWrap: true,
children: <Widget>[
ExpansionTile(
title: Text("Categories"),
children: [
CheckboxListTile(
controlAffinity: ListTileControlAffinity.trailing,
title: Text( "Cars", maxLines: 1, ),
),
CheckboxListTile(
controlAffinity: ListTileControlAffinity.trailing,
title: Text("Veichle", maxLines: 1, ),
),
],
initiallyExpanded: true,
),
],
),
),
Upvotes: 4
Views: 3179
Reputation: 218
By adding A ListTileTheme
before each ExpansionTile
and making dense: true,
it will make Padding more "Reasonable"
Expanded(
child: ListView(
padding: EdgeInsets.all(0.0) ,
primary: true,
shrinkWrap: true,
children: <Widget>[
ListTileTheme(
dense: true,
child: ExpansionTile(
title: Text("Categories"),
children: [
CheckboxListTile(
controlAffinity: ListTileControlAffinity.trailing,
title: Text( "Cars", maxLines: 1, ),
),
CheckboxListTile(
controlAffinity: ListTileControlAffinity.trailing,
title: Text("Veichle", maxLines: 1, ),
),
],
initiallyExpanded: true,
),
),
],
),
)
Upvotes: 5