diff --git a/lib/ui/drawer.dart b/lib/ui/drawer.dart new file mode 100644 index 0000000..9ca186b --- /dev/null +++ b/lib/ui/drawer.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; + +Drawer theDrawer(context) { + return Drawer( + child: ListView(padding: EdgeInsets.zero, children: [ + DrawerHeader( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.view_list), + Text("Main menu"), + ]), + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + )), + ListTile( + title: Row(children: [Icon(Icons.home), Text("Home")]), + onTap: () { + Navigator.of(context).pushNamed("/"); + }, + ), + ListTile( + title: Row(children: [Icon(Icons.build), Text("Operations")]), + onTap: () { + Navigator.of(context).pushNamed("/operations"); + }, + ), + ListTile( + title: Row(children: [Icon(Icons.settings), Text("Settings")]), + onTap: () { + Navigator.of(context).pushNamed("/settings"); + }, + ) + ])); +} diff --git a/lib/ui/main_page.dart b/lib/ui/main_page.dart index 275f3cc..9a79c06 100644 --- a/lib/ui/main_page.dart +++ b/lib/ui/main_page.dart @@ -3,6 +3,8 @@ import 'package:logger/logger.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'dart:async'; +import 'drawer.dart'; + var log = Logger(); class _DataState { @@ -142,6 +144,7 @@ class HomePageState extends State { return Scaffold( appBar: AppBar(title: Text(title)), body: _body(), + drawer: theDrawer(context), ); } }