September 2019
Beginner
512 pages
12h 52m
English
It is time to check out how to use the Navigator widget in practice. Let's create a basic flow to navigate to a second screen and back. It will look something like this:

The basic way to use a Navigator widget is like any other—by adding it to the widget tree:
class NavigatorDirectlyApp extends StatelessWidget { @override Widget build(BuildContext context) { return Directionality( child: Navigator( onGenerateRoute: (RouteSettings settings) { return MaterialPageRoute( builder: (BuildContext context) => _screen1(context)); }, ), textDirection: TextDirection.ltr, ); } _screen1(BuildContext context) {...} // hidden for ...