-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[go_router] Nested stateful navigation with ShellRoute #2650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
fa4c542
76b17ae
7612a55
62574bd
850f41a
1c04588
1db6bba
6028c90
5f2e995
461efd9
0315e1a
510ec34
e82647a
e38fa32
f38b9bf
89f1dd7
3a00a54
b0a6264
b729d64
3b3909f
f0b2a1b
eb6d4d3
016be76
4ae26d7
4a9889a
1f3f01a
3b38641
d701ab5
bb6240d
245d47b
bda571b
da1ea0b
59c19e7
723de76
4c0a91d
7556965
ee9bde9
e9a7029
59a6b05
06ab1e9
1b877c8
e542a05
2215a51
b180653
8fdfb82
9240ea4
93bce8e
20dc0c6
376e80f
2b2ff91
5c9fe04
81e1296
59e3b66
8636bf8
1c509f1
42c7b7d
62e7fc1
9a7069a
ae48ede
141fdc1
b6b289f
4d05d99
d4edd47
7b9de47
703815c
9f88928
5ca533d
f5f0ecb
4a2eac3
fc7bd54
a65f9df
816acb2
ee2a845
89b82c5
90b9d62
7392264
c0253f6
2c4afa1
845c052
193a267
37c4969
c562482
38b5772
db22bac
d8d1641
4c4b7b0
f08f548
6f1b047
07ee030
9ffff5c
e9d40ee
0ea48cb
4abcaa9
ce23558
351ceb2
4cb0f1e
e6a4f71
873bf34
5b668f8
565c3cd
5ee1a8f
358551f
f9a2608
87211aa
257a272
08148e5
c18941f
b1ce762
75e43d0
9f54b4e
1226f44
881be86
6bbbd29
fd5412f
a5234a6
b9428cb
ee047c8
ddc71f0
5041bea
01cce04
9315373
89341ef
2c298cd
4c22b53
a7d419f
7285788
9983887
ad43837
3a83007
ec6722c
9bb0da9
a1c7a8f
477b47c
7f25f0c
6f35636
bb5c08f
16c095c
a18a5a5
abbd01b
0f36623
316cf8c
79a0c63
3696448
763b136
2f48831
709ee7a
bb7fd9e
9eaf1af
527a806
86a72e1
57b761f
85fa0b6
d75c5e2
bd1c018
c13cd71
c7b1295
0f842ee
80c396f
04b549a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -513,12 +513,11 @@ class ShellRoute extends ShellRouteBase { | |
| /// this shorthand constructor, the [GoRoute.parentNavigatorKey] will be used | ||
| /// as the Navigator key. | ||
| /// | ||
| /// Like [ShellRoute], you can provide a builder ([ShellRouteBranchState]) and | ||
| /// pageBuilder ([ShellRoutePageBuilder]) when creating a StatefulShellRoute. | ||
| /// However, StatefulShellRoute differs in that the builder is mandatory and the | ||
| /// pageBuilder will be used in addition to the builder. The child parameters of | ||
| /// the builders are also a bit different, even though this should normally not | ||
| /// affect how you implemented the builders. | ||
| /// Like [ShellRoute], you can provide a [builder] and [pageBuilder] when | ||
| /// creating a StatefulShellRoute. However, StatefulShellRoute differs in that | ||
| /// the builder is mandatory and the pageBuilder will be used in addition to the | ||
| /// builder. The child parameters of the builders are also a bit different, even | ||
tolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// though this should normally not affect how you implemented the builders. | ||
| /// | ||
| /// For the pageBuilder, the child parameter will simply be the stateful shell | ||
tolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// already built for this route, using the builder function. In the builder | ||
tolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
@@ -532,12 +531,23 @@ class ShellRoute extends ShellRouteBase { | |
| /// wrapper Widget that provides access to the current [StatefulShellRouteState] | ||
tolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// associated with the route (via the method [StatefulShellRoute.of]). That | ||
| /// state object exposes information such as the current branch index, the state | ||
| /// of the route branches etc. | ||
| /// of the route branches etc. It is also with the help this state object you | ||
| /// can change the active branch, i.e. restore the navigation stack of another | ||
| /// branch. This is accomplished using the method | ||
| /// [StatefulShellRouteState.goBranch]. For example: | ||
| /// | ||
| /// For implementations where greater control is needed over the layout and | ||
| /// animations of the Navigators, the child parameter in builder can be ignored, | ||
| /// and a custom implementation can instead be built by using the Navigators | ||
| /// (and other information from StatefulShellRouteState) directly. For example: | ||
| /// ``` | ||
| /// void _onBottomNavigationBarItemTapped(BuildContext context, int index) { | ||
| /// final StatefulShellRouteState shellState = StatefulShellRoute.of(context); | ||
| /// shellState.goBranch(index); | ||
| /// } | ||
| /// ``` | ||
| /// | ||
| /// Sometimes you need greater control over the layout and animations of the | ||
tolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// branch Navigators. In such cases, the child argument in the builder function | ||
| /// can be ignored, and a custom implementation can instead be built using the | ||
| /// branch Navigators (see [StatefulShellRouteState.navigators]) directly. For | ||
| /// example: | ||
| /// | ||
| /// ``` | ||
| /// final StatefulShellRouteState shellState = StatefulShellRoute.of(context); | ||
|
|
@@ -551,7 +561,7 @@ class ShellRoute extends ShellRouteBase { | |
| /// BottomNavigationBar with two tabs is used, and each of the tabs gets its | ||
| /// own Navigator. A container widget responsible for managing the Navigators | ||
| /// for all route branches will then be passed as the child argument | ||
| /// of the [builder] function. | ||
| /// of the builder function. | ||
| /// | ||
| /// ``` | ||
tolo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// final GlobalKey<NavigatorState> _tabANavigatorKey = | ||
|
|
@@ -609,8 +619,8 @@ class ShellRoute extends ShellRouteBase { | |
| /// ``` | ||
| /// | ||
| /// When the [Page] for this route needs to be customized, you need to pass a | ||
| /// function for [pageBuilder]. Note that this page provider doesn't replace | ||
| /// the [builder] function, but instead receives the stateful shell built by | ||
| /// function for pageBuilder. Note that this page builder doesn't replace | ||
| /// the builder function, but instead receives the stateful shell built by | ||
| /// [StatefulShellRoute] (using the builder function) as input. In other words, | ||
|
||
| /// you need to specify both when customizing a page. For example: | ||
| /// | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.