drawer navigation
This commit is contained in:
parent
c133eda312
commit
a9df9ab96b
|
|
@ -30,18 +30,41 @@ class MyHomePage extends StatefulWidget {
|
||||||
State<MyHomePage> createState() => _MyHomePageState();
|
State<MyHomePage> createState() => _MyHomePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum GameType { classicTTC, superTTC }
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
|
GameType type = GameType.classicTTC;
|
||||||
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: Drawer(
|
drawer: Drawer(
|
||||||
|
key: _scaffoldKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
DrawerHeader(
|
const DrawerHeader(
|
||||||
child: Text("Game Types"),
|
child: Text(
|
||||||
|
"Game Types",
|
||||||
|
style: TextStyle(fontSize: 25),
|
||||||
),
|
),
|
||||||
ListTile(title: Text("Clasic")),
|
),
|
||||||
ListTile(title: Text("Super")),
|
ListTile(
|
||||||
|
title: const Text("Classic"),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
type = GameType.classicTTC;
|
||||||
|
});
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text("Super"),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
type = GameType.superTTC;
|
||||||
|
});
|
||||||
|
Navigator.pop(context);
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
|
@ -50,7 +73,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(10),
|
padding: const EdgeInsets.all(10),
|
||||||
child: ClassicGame(),
|
child: type == GameType.classicTTC
|
||||||
|
? const ClassicGame()
|
||||||
|
: const Center(child: Text("Under Construction")),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue