答案 0 :(得分:1)
答案 1 :(得分:1)
您可以使用扩展图块实现此结果:
bool _isExpanded = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Expansion Tile'),
),
drawer: Drawer(
child: Column(
children: <Widget>[
ExpansionTile(
onExpansionChanged: (b) {
setState(() {
_isExpanded = !_isExpanded; //using set state just to exemplify
});
},
title: Text('Expand items'),
trailing: Padding(
padding: const EdgeInsets.only(right: 100),
child: Icon(_isExpanded
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 30, right: 60),
child: ExpansionTile(
title: Text('First child'),
),
),
Padding(
padding: const EdgeInsets.only(left: 30, right: 60),
child: ExpansionTile(
title: Text('Second child'),
),
),
],
)
],
),
),
);
}
结果: