Skip to content

Instantly share code, notes, and snippets.

@paulallies
Created June 20, 2018 10:25
Show Gist options
  • Save paulallies/7fe067d948b5850a4ba10e341ae901f6 to your computer and use it in GitHub Desktop.
Save paulallies/7fe067d948b5850a4ba10e341ae901f6 to your computer and use it in GitHub Desktop.
My Drawer Flutter Nav
import 'package:flutter/material.dart';
class MyDrawer extends StatelessWidget {
_gotoPage(String route, BuildContext context) {
Navigator.of(context).pushReplacementNamed(route);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Drawer(
child: new ListView(
padding: EdgeInsets.all(16.0),
children: <Widget>[
new ListTile(
leading: new Icon(Icons.home),
title: new Text('Home'),
onTap: () {
// change app state...
_gotoPage("/home", context);
},
),
new ListTile(
leading: new Icon(Icons.info),
title: new Text('Page 2'),
onTap: () {
// change app state...
_gotoPage("/page2", context);
},
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment