您要查找的特定类型的小部件称为抽屉。您可以访问https://flutter.dev/docs/cookbook/design/drawer了解完整详情。让我也给出一个抽屉代码示例。
class Trial extends State<State1> {
Widget build(BuildContext context) {
return Scaffold(
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Center(
child: Text(
'Choose an Option:',
style: TextStyle(
fontSize: 30,
),
),
),
decoration: BoxDecoration(
color: Colors.blue,
),
),
Padding(
child: Card(
child: ListTile(
leading: Icon(
Icons.add,
size: 35,
),
title: Text(
'Increment by 2',
style: TextStyle(
fontSize: 20,
),
textAlign: TextAlign.center,
),
onTap: () {
setState(() {
increment = 2;
Navigator.pop(context);
});
},
),
),
padding: EdgeInsets.all(9.0),
),
],
),
),
);
}