September 2019
Beginner
512 pages
12h 52m
English
Our previous example using the WidgetsApp widget is very simple, but we can turn it into a more organized way of doing things. By using named routes, we can do the following:
Let's check it out:
// navigation_widgetsapp_named_routes.dartclass _NavigatorNamedRoutesWidgetsAppState extends State<NavigatorNamedRoutesWidgetsApp> { @override Widget build(BuildContext context) { return WidgetsApp( color: Colors.blue, routes: { '/': (context) => _screen1(context), '/2': (context) => _screen2(context), }, pageRouteBuilder: <Void>(RouteSettings settings, WidgetBuilder builder) { return MaterialPageRoute(builder: builder, settings: ...Read now
Unlock full access