mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
5 years ago | |
---|---|---|
.. | ||
android | 5 years ago | |
ios | 5 years ago | |
lib | 5 years ago | |
.gitignore | 5 years ago | |
.metadata | 5 years ago | |
README.md | 5 years ago | |
pubspec.lock | 5 years ago | |
pubspec.yaml | 5 years ago |
README.md
Navigation and Routing sample code
Sample code for Learning Flutter's New Navigation and Routing System, an article explaining Navigator 2.0.
Samples
Navigator 1.0 samples
nav_1/anonymous_routes.dart
- Shows how to use a Navigator to push and pop anonymous routes (e.g. MaterialPageRoute)nav_1/named_routes.dart
- Shows how to use define named routes via theroutes
parameter on MaterialApp, and navigate using Navigator.pushNamednav_1/on_generate_route.dart
- Shows how to handle arbitrary named routes using theonGenerateRoute
callback defined in theMaterialApp
constructor.
** Navigator 2.0 samples**
nav_2/pages.dart
- Shows how to define a list of [Page] objects on Navigator declaratively.nav_2/router.dart
- Full sample that shows a custom RouteInformationParser and RouterDelegate parsing named routes and declaratively building the stack of pages for the Navigator.
** Advanced **
nav_2_advanced/nested_router.dart
- Shows two [RouterDelegate], one nested within the other. A [BottomNavigationBar] can be used to select the route of the outer RouterDelegate, and additional routes can be pushed onto the inner RouterDelegate / Navigator.nav_2_advanced/transition_delegate.dart
- Shows how a custom TransitionDelegate can be used to customized when transition animations are shown.
Running
Each file in this project is an entrypoint. To run, specify the filename of the sample:
flutter run lib/nav_2/router.dart