Adding drawer.

This commit is contained in:
sfigato 2019-08-30 01:28:50 +02:00
parent d4c278cd14
commit b677865c21
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
2 changed files with 38 additions and 0 deletions

35
lib/ui/drawer.dart Normal file
View File

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
Drawer theDrawer(context) {
return Drawer(
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
DrawerHeader(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Icon(Icons.view_list),
Text("Main menu"),
]),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
)),
ListTile(
title: Row(children: <Widget>[Icon(Icons.home), Text("Home")]),
onTap: () {
Navigator.of(context).pushNamed("/");
},
),
ListTile(
title: Row(children: <Widget>[Icon(Icons.build), Text("Operations")]),
onTap: () {
Navigator.of(context).pushNamed("/operations");
},
),
ListTile(
title: Row(children: <Widget>[Icon(Icons.settings), Text("Settings")]),
onTap: () {
Navigator.of(context).pushNamed("/settings");
},
)
]));
}

View File

@ -3,6 +3,8 @@ import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'dart:async'; import 'dart:async';
import 'drawer.dart';
var log = Logger(); var log = Logger();
class _DataState { class _DataState {
@ -142,6 +144,7 @@ class HomePageState extends State<HomePage> {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text(title)), appBar: AppBar(title: Text(title)),
body: _body(), body: _body(),
drawer: theDrawer(context),
); );
} }
} }