diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md index b928c46d5af..87d27d4d075 100644 --- a/packages/go_router/CHANGELOG.md +++ b/packages/go_router/CHANGELOG.md @@ -1,8 +1,10 @@ -## NEXT +## 6.3.0 - Aligns Dart and Flutter SDK constraints. - Updates compileSdkVersion to 33. - Updates example app to iOS 11. +- Adds `navigatorKey` to `TypedShellRoute` +- Adds `parentNavigatorKey` to `TypedGoRoute` - Updates documentation in matching methods. ## 6.2.0 @@ -23,7 +25,7 @@ ## 6.0.8 -* Adds support for Iterables, Lists and Sets in query params for TypedGoRoute. [#108437](https://github.com/flutter/flutter/issues/108437). +- Adds support for Iterables, Lists and Sets in query params for TypedGoRoute. [#108437](https://github.com/flutter/flutter/issues/108437). ## 6.0.7 diff --git a/packages/go_router/lib/src/route.dart b/packages/go_router/lib/src/route.dart index 7f4b9c12868..f8a22172a5e 100644 --- a/packages/go_router/lib/src/route.dart +++ b/packages/go_router/lib/src/route.dart @@ -292,11 +292,13 @@ class GoRoute extends RouteBase { /// re-evaluation will be triggered if the [InheritedWidget] changes. final GoRouterRedirect? redirect; + /// {@template go_router.GoRoute.parentNavigatorKey} /// An optional key specifying which Navigator to display this route's screen /// onto. /// /// Specifying the root Navigator will stack this route onto that /// Navigator instead of the nearest ShellRoute ancestor. + /// {@endtemplate} final GlobalKey? parentNavigatorKey; // TODO(chunhtai): move all regex related help methods to path_utils.dart. @@ -454,8 +456,10 @@ class ShellRoute extends RouteBase { /// sub-route's observers. final List? observers; + /// {@template go_router.ShellRoute.navigatorKey} /// The [GlobalKey] to be used by the [Navigator] built for this route. /// All ShellRoutes build a Navigator by default. Child GoRoutes /// are placed onto this Navigator instead of the root Navigator. + /// {@endtemplate} final GlobalKey navigatorKey; } diff --git a/packages/go_router/lib/src/route_data.dart b/packages/go_router/lib/src/route_data.dart index 3530ca250fc..2be9c36478b 100644 --- a/packages/go_router/lib/src/route_data.dart +++ b/packages/go_router/lib/src/route_data.dart @@ -224,6 +224,7 @@ class TypedGoRoute extends TypedRoute { const TypedGoRoute({ required this.path, this.routes = const >[], + this.parentNavigatorKey, }); /// The path that corresponds to this route. @@ -237,6 +238,9 @@ class TypedGoRoute extends TypedRoute { /// /// See [RouteBase.routes]. final List> routes; + + /// {@macro go_router.GoRoute.parentNavigatorKey} + final GlobalKey? parentNavigatorKey; } /// A superclass for each typed shell route descendant @@ -245,12 +249,16 @@ class TypedShellRoute extends TypedRoute { /// Default const constructor const TypedShellRoute({ this.routes = const >[], + this.navigatorKey, }); /// Child route definitions. /// /// See [RouteBase.routes]. final List> routes; + + /// {@macro go_router.ShellRoute.navigatorKey} + final GlobalKey? navigatorKey; } /// Internal class used to signal that the default page behavior should be used. diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml index 98221bae303..c5f6ea14d35 100644 --- a/packages/go_router/pubspec.yaml +++ b/packages/go_router/pubspec.yaml @@ -1,7 +1,7 @@ name: go_router description: A declarative router for Flutter based on Navigation 2 supporting deep linking, data-driven routes and more -version: 6.2.0 +version: 6.3.0 repository: https://github.com/flutter/packages/tree/main/packages/go_router issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22