Rename Navigator 2.0 to Router (#712)

* Rename Navigator 2.0 to Router

This aligns better with the documentation for this new API, and doesn't
imply that apps need to be upgraded.

* introduction -> navigator
pull/717/head
John Ryan 5 years ago committed by GitHub
parent b6d9411aa1
commit 43189d90f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,49 +1,47 @@
# Navigation and Routing sample code # Navigation and Routing sample code
Sample code for [Learning Flutter's New Navigation and Routing System][article], Sample code for [Learning Flutter's New Navigation and Routing System][article],
an article explaining Navigator 2.0. an article explaining the Router widget and it's associated classes.
## Samples ## Samples
**Navigator 1.0 samples** **Navigator samples**
* [nav_1/anonymous_routes.dart](lib/nav_1/anonymous_routes.dart) - Shows how to * [navigator/anonymous_routes.dart](lib/navigator/anonymous_routes.dart) -
use a Navigator to push and pop anonymous routes (e.g. MaterialPageRoute) Shows how to use a Navigator to push and pop anonymous routes (e.g.
* [nav_1/named_routes.dart](lib/nav_1/named_routes.dart) - Shows how to use MaterialPageRoute)
define named routes via the `routes` parameter on MaterialApp, and navigate * [navigator/named_routes.dart](lib/navigator/named_routes.dart) - Shows
using Navigator.pushNamed how to use define named routes via the `routes` parameter on MaterialApp, and
* [nav_1/on_generate_route.dart](lib/nav_1/on_generate_route.dart) - Shows how navigate using Navigator.pushNamed
to handle arbitrary named routes using the `onGenerateRoute` callback defined * [navigator/on_generate_route.dart](lib/navigator/on_generate_route.dart) -
in the `MaterialApp` constructor. Shows how to handle arbitrary named routes using the `onGenerateRoute`
callback defined in the `MaterialApp` constructor.
**Navigator 2.0 samples** **Router samples**
* [nav_2/pages.dart](lib/nav_2/pages.dart) - Shows how to define a list of * [router/pages.dart](lib/router/pages.dart) - Shows how to define a list of
[Page] objects on Navigator declaratively. [Page] objects on Navigator declaratively.
* [nav_2/router.dart](lib/nav_2/router.dart) - Full sample that shows a custom * [router/router.dart](lib/router/router.dart) - Full sample that shows a custom
RouteInformationParser and RouterDelegate parsing named routes and RouteInformationParser and RouterDelegate parsing named routes and
declaratively building the stack of pages for the Navigator. declaratively building the stack of pages for the Navigator.
**Advanced** **Advanced**
* [nav_2_advanced/nested_router.dart](lib/nav_2_advanced/nested_router.dart) - * [router_advanced/nested_router.dart](lib/router_advanced/nested_router.dart) -
Shows two [RouterDelegate], one nested within the other. A Shows two [RouterDelegate], one nested within the other. A
[BottomNavigationBar] can be used to select the route of the outer [BottomNavigationBar] can be used to select the route of the outer
RouterDelegate, and additional routes can be pushed onto the inner RouterDelegate, and additional routes can be pushed onto the inner
RouterDelegate / Navigator. RouterDelegate / Navigator.
* [nav_2_advanced/transition_delegate.dart](lib/nav_2_advanced/transition_delegate.dart) * [router_advanced/transition_delegate.dart](lib/router_advanced/transition_delegate.dart)
Shows how a custom TransitionDelegate can be used to customized when Shows how a custom TransitionDelegate can be used to customized when
transition animations are shown. transition animations are shown.
## Running ## Running
Each file in this project is an entrypoint. To run, specify the filename of Each file in this project is an entrypoint. To run, specify the filename of
the sample: the sample:
```bash ```bash
flutter run lib/nav_2/router.dart flutter run lib/router/router.dart
``` ```
[article]: https://medium.com/flutter/learning-flutters-new-navigation-and-routing-system-7c9068155ade [article]: https://medium.com/flutter/learning-flutters-new-navigation-and-routing-system-7c9068155ade

@ -5,7 +5,7 @@
/// Shows how a custom TransitionDelegate can be used to customized when /// Shows how a custom TransitionDelegate can be used to customized when
/// transition animations are shown. (For example, [when two routes are popped /// transition animations are shown. (For example, [when two routes are popped
/// off the stack](https://github.com/flutter/flutter/issues/12146), however the /// off the stack](https://github.com/flutter/flutter/issues/12146), however the
/// default TransitionDelegate will handle this if you are using Navigator 2.0) /// default TransitionDelegate will handle this if you are using Router)
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { void main() {
Loading…
Cancel
Save