Skip to content

Instantly share code, notes, and snippets.

@ijoschek ijoschek/.\lib\main.dart Secret
Last active Apr 7, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.