Skip to content

Instantly share code, notes, and snippets.

@DaniyarGilimov
Created June 22, 2019 10:01
Show Gist options
  • Save DaniyarGilimov/324abc2169497c26031ae3a532454227 to your computer and use it in GitHub Desktop.
Save DaniyarGilimov/324abc2169497c26031ae3a532454227 to your computer and use it in GitHub Desktop.
Navigation with rootPages' BuildContext
class MainTabOrDetailPage extends StatefulWidget {
final BuildContext rootContext;
StudentMainTab({@required this.rootContext});
@override
State<StatefulWidget> createState() {
return _MainTabOrDetailPage();
}
}
class _MainTabOrDetailPage extends State<MainTabOrDetailPage> {
@override
Widget build(BuildContext context) {
return Navigator(
onGenerateRoute: (RouteSettings settings) {
return new MaterialPageRoute(
settings: settings,
builder: (BuildContext context) {
return Scaffold(
body:
//List
,
floatingActionButton: FloatingActionButton(
child: Icon,
onPressed: () {
Navigator.push(
widget.rootContext,
MaterialPageRoute(
builder: (context) =>
StudentRequestPage()));
},
));
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment