mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
Add a sample Drawer
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:journal/state_container.dart';
|
import 'package:journal/state_container.dart';
|
||||||
|
import 'package:journal/widgets/app_drawer.dart';
|
||||||
import 'package:journal/widgets/journal_list.dart';
|
import 'package:journal/widgets/journal_list.dart';
|
||||||
import 'package:journal/note_editor.dart';
|
import 'package:journal/note_editor.dart';
|
||||||
import 'package:journal/note_viewer.dart';
|
import 'package:journal/note_viewer.dart';
|
||||||
@ -33,6 +34,7 @@ class HomeScreen extends StatelessWidget {
|
|||||||
Navigator.of(context).push(route);
|
Navigator.of(context).push(route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
drawer: new AppDrawer(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
44
lib/widgets/app_drawer.dart
Normal file
44
lib/widgets/app_drawer.dart
Normal 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
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user