Adding drawer.
This commit is contained in:
parent
d4c278cd14
commit
b677865c21
35
lib/ui/drawer.dart
Normal file
35
lib/ui/drawer.dart
Normal 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");
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]));
|
||||||
|
}
|
|
@ -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),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user