Skip to content

Instantly share code, notes, and snippets.

@ijoschek
Last active April 7, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijoschek/3e8968ff6d6be2ee5f53352f95368be0 to your computer and use it in GitHub Desktop.
Save ijoschek/3e8968ff6d6be2ee5f53352f95368be0 to your computer and use it in GitHub Desktop.
flutter_nav_tut
// ...
class Main extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// ...
routes: {
'/newPage': (context) => NewPage(title: "Via routed navigation!"),
},
);
}
}
// ...
class _MainPageState extends State<MainPage> {
// ...
@override
Widget build(BuildContext context) {
return Scaffold(
// ...
drawer: Drawer(
child: ListView(
children: <Widget>[
// ...
ListTile(
// ...
onTap: () {
Navigator.of(context).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
NewPage(title: "Via MaterialPageRoute")));
},
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment