Skip to content

Commit c9bab5e

Browse files
Add menu with Drawer.
1 parent d1e7bd5 commit c9bab5e

File tree

1 file changed

+40
-0
lines changed
  • Template/MobileTemplate/flutter_template/lib

1 file changed

+40
-0
lines changed

Template/MobileTemplate/flutter_template/lib/main.dart

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,46 @@ class _MyHomePageState extends State<MyHomePage> {
108108
tooltip: 'Increment',
109109
child: Icon(Icons.add),
110110
), // This trailing comma makes auto-formatting nicer for build methods.
111+
drawer: Drawer(
112+
child: ListView(
113+
children: <Widget>[
114+
DrawerHeader(
115+
child: Text('Drawer Header'),
116+
decoration: BoxDecoration(
117+
color: Colors.blue,
118+
),
119+
),
120+
ListTile(
121+
title: Text("Item 1"),
122+
trailing: Icon(Icons.arrow_forward),
123+
onTap: () {
124+
Navigator.of(context).pop();
125+
Navigator.of(context).push(
126+
MaterialPageRoute(
127+
builder: (context) {
128+
return MyHomePage(title: 'Flutter Demo Home PageA');
129+
},
130+
),
131+
);
132+
},
133+
),
134+
ListTile(
135+
title: Text("Item 2"),
136+
trailing: Icon(Icons.arrow_forward),
137+
onTap: () {
138+
Navigator.of(context).pop();
139+
Navigator.of(context).push(
140+
MaterialPageRoute(
141+
builder: (context) {
142+
return MyHomePage(title: 'Flutter Demo Home PageB');
143+
},
144+
),
145+
);
146+
},
147+
),
148+
],
149+
),
150+
),
111151
);
112152
}
113153
}

0 commit comments

Comments
 (0)