Add a sample Drawer

This commit is contained in:
Vishesh Handa
2018-05-25 01:17:49 +02:00
parent 0551cc0538
commit c30ed0c9f4
2 changed files with 46 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:journal/state_container.dart';
import 'package:journal/widgets/app_drawer.dart';
import 'package:journal/widgets/journal_list.dart';
import 'package:journal/note_editor.dart';
import 'package:journal/note_viewer.dart';
@ -33,6 +34,7 @@ class HomeScreen extends StatelessWidget {
Navigator.of(context).push(route);
},
),
drawer: new AppDrawer(),
);
}

View File

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
class AppDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Drawer(
// Add a ListView to the drawer. This ensures the user can scroll
// through the options in the Drawer if there isn't enough vertical
// space to fit everything.
child: new ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: <Widget>[
new UserAccountsDrawerHeader(
accountEmail: new Text("me@vhanda.in"),
accountName: new Text("Vishesh Handa"),
decoration: new BoxDecoration(
color: Colors.blue,
),
),
new ListTile(
title: new Text('Item 1'),
onTap: () {
Navigator.pop(context);
// Update the state of the app
// ...
},
),
new ListTile(
title: new Text('Item 2'),
onTap: () {
Navigator.pop(context);
// Update the state of the app
// ...
},
),
],
),
);
}
}