@@ -121,24 +121,25 @@ class RouteBuilder {
121
121
configuration: configuration,
122
122
errorBuilder: errorBuilder,
123
123
errorPageBuilder: errorPageBuilder,
124
+ requestFocus: requestFocus,
124
125
),
125
126
);
126
127
}
127
128
}
128
129
129
130
class _CustomNavigator extends StatefulWidget {
130
- const _CustomNavigator ({
131
- super .key,
132
- required this .navigatorKey,
133
- required this .observers,
134
- required this .navigatorRestorationId,
135
- required this .onPopPageWithRouteMatch,
136
- required this .matchList,
137
- required this .matches,
138
- required this .configuration,
139
- required this .errorBuilder,
140
- required this .errorPageBuilder,
141
- });
131
+ const _CustomNavigator (
132
+ { super .key,
133
+ required this .navigatorKey,
134
+ required this .observers,
135
+ required this .navigatorRestorationId,
136
+ required this .onPopPageWithRouteMatch,
137
+ required this .matchList,
138
+ required this .matches,
139
+ required this .configuration,
140
+ required this .errorBuilder,
141
+ required this .errorPageBuilder,
142
+ required this .requestFocus });
142
143
143
144
final GlobalKey <NavigatorState > navigatorKey;
144
145
final List <NavigatorObserver > observers;
@@ -155,6 +156,7 @@ class _CustomNavigator extends StatefulWidget {
155
156
final String ? navigatorRestorationId;
156
157
final GoRouterWidgetBuilder ? errorBuilder;
157
158
final GoRouterPageBuilder ? errorPageBuilder;
159
+ final bool requestFocus;
158
160
159
161
@override
160
162
State <StatefulWidget > createState () => _CustomNavigatorState ();
@@ -283,19 +285,19 @@ class _CustomNavigatorState extends State<_CustomNavigator> {
283
285
String ? restorationScopeId,
284
286
) {
285
287
return _CustomNavigator (
286
- // The state needs to persist across rebuild.
287
- key: GlobalObjectKey (navigatorKey.hashCode),
288
- navigatorRestorationId: restorationScopeId,
289
- navigatorKey: navigatorKey,
290
- matches: match.matches,
291
- matchList: matchList,
292
- configuration: widget.configuration,
293
- observers: observers ?? const < NavigatorObserver > [],
294
- onPopPageWithRouteMatch: widget.onPopPageWithRouteMatch,
295
- // This is used to recursively build pages under this shell route.
296
- errorBuilder: widget.errorBuilder,
297
- errorPageBuilder: widget.errorPageBuilder,
298
- );
288
+ // The state needs to persist across rebuild.
289
+ key: GlobalObjectKey (navigatorKey.hashCode),
290
+ navigatorRestorationId: restorationScopeId,
291
+ navigatorKey: navigatorKey,
292
+ matches: match.matches,
293
+ matchList: matchList,
294
+ configuration: widget.configuration,
295
+ observers: observers ?? const < NavigatorObserver > [],
296
+ onPopPageWithRouteMatch: widget.onPopPageWithRouteMatch,
297
+ // This is used to recursively build pages under this shell route.
298
+ errorBuilder: widget.errorBuilder,
299
+ errorPageBuilder: widget.errorPageBuilder,
300
+ requestFocus : widget.requestFocus );
299
301
},
300
302
);
301
303
final Page <Object ?>? page =
@@ -437,6 +439,7 @@ class _CustomNavigatorState extends State<_CustomNavigator> {
437
439
controller: _controller! ,
438
440
child: Navigator (
439
441
key: widget.navigatorKey,
442
+ requestFocus: widget.requestFocus,
440
443
restorationScopeId: widget.navigatorRestorationId,
441
444
pages: _pages! ,
442
445
observers: widget.observers,
0 commit comments