You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 01aa7fc
Browse filesBrowse the repository at this point in the historyBrowse files
[go_router] Stop inactive StatefulShellRoute branches from vetoing pops
The Navigator of every StatefulShellRoute branch is wrapped in a PopScope
that keeps the shell itself from being popped, for example by an iOS back
gesture, while the branch has an active sub-route.
Inactive branches stay mounted, so their PopScope stays registered as a pop
entry of the same enclosing route as the active one, and ModalRoute only
allows a pop if every registered entry allows it. Switching away from a
branch that still had a sub-route therefore suppressed the system back
button for the whole app: popRoute() reported the pop as handled without
popping anything, so Android never closed the activity.
The guard now only applies to the active branch. StatefulNavigationShell
publishes which of its branches is active through an ActiveBranchScope
inherited widget, and the PopScope depends on it, so canPop is also kept up
to date when the user switches branches without the route matches of a
branch changing. Behavior is unchanged for a plain ShellRoute, which has no
enclosing ActiveBranchScope.
Fixesflutter/flutter#193098
0 commit comments