This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
// ... | |
_createDrawerItem(icon: Icons.event, text: 'Events', | |
onTap: () => Navigator.pushReplacementNamed(context, Routes.events))), | |
// ... | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventsPage extends StatelessWidget { | |
static const String routeName = '/events'; | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: AppBar( | |
title: Text("Events"), | |
), | |
drawer: AppDrawer(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Routes { | |
static const String contacts = ContactsPage.routeName; | |
static const String events = EventsPage.routeName; | |
static const String notes = NotesPage.routeName; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
_createHeader(), | |
_createDrawerItem(icon: Icons.contacts, text: 'Contacts', onTap: () => ...) | |
Divider(), | |
_createDrawerItem(icon: Icons.event, text: 'Events', onTap: () => ...), | |
ListTile( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
_createHeader(), | |
_createDrawerItem(icon: Icons.contacts, text: 'Contacts', onTap: () => ...) | |
Divider(), | |
_createDrawerItem(icon: Icons.event, text: 'Events', onTap: () => ...) | |
], | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
_createHeader(), | |
_createDrawerItem( | |
icon: Icons.contacts, | |
text: 'Contacts', | |
onTap: () => ..., | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ | |
_createHeader() | |
], | |
), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Widget _createDrawerItem( | |
{IconData icon, String text, GestureTapCallback onTap}) { | |
return ListTile( | |
title: Row( | |
children: <Widget>[ | |
Icon(icon), | |
Padding( | |
padding: EdgeInsets.only(left: 8.0), | |
child: Text(text), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Widget _createHeader() { | |
return DrawerHeader( | |
margin: EdgeInsets.zero, | |
padding: EdgeInsets.zero, | |
decoration: BoxDecoration( | |
image: DecorationImage( | |
fit: BoxFit.fill, | |
image: AssetImage('res/images/drawer_header_background.png'))), | |
child: Stack(children: <Widget>[ | |
Positioned( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class AppDrawer extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Drawer( | |
child: ListView( | |
padding: EdgeInsets.zero, | |
children: <Widget>[ ], |
NewerOlder