这里是内联小组件代码。
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,
),
],
),
),
通过添加A ListTileTheme
前每 ExpansionTile
并使 dense: true,
它将使Padding更多 "合理"
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,
),
),
],
),
)