-
-
Save ijoschek/3e8968ff6d6be2ee5f53352f95368be0 to your computer and use it in GitHub Desktop.
flutter_nav_tut
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 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