-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
Use case
The GoRoute class has a parentNavigatorKey parameter which is useful to specify which Navigator to display the route's screen onto. However when using go_router_builder, there is currently no way of specifying such a key.
Proposal
Implement a way to specify a GlobalKey<NavigatorState?> somewhere when declaring routes to be generated.
Maybe overriding a getter in GoRouteData like so:
final rootNavigatorKey = GlobalKey<NavigatorState>();
@TypedGoRoute<SplashRoute>(
path: '/splash',
)
class SplashRoute extends GoRouteData {
const SplashRoute();
@override
Widget build(BuildContext context, GoRouterState state) =>
const SplashScreen();
@override
GlobalKey<NavigatorState>? get parentNavigatorKey => rootNavigatorKey;
}Or specifying the name of the global key like so, which would follow the pattern of how GoRoute are manually declared.
final rootNavigatorKey = GlobalKey<NavigatorState>();
@TypedGoRoute<SplashRoute>(
path: '/splash',
parentNavigatorKey:'rootNavigatorKey',
)
class SplashRoute extends GoRouteData {
const SplashRoute();
@override
Widget build(BuildContext context, GoRouterState state) =>
const SplashScreen();
}arnab, GP4cK, thomasostfeld, jeiea, do9core and 2 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.