Skip to content

[go_router] Refactors GoRouter.pop to handle pageless route#2879

Merged
auto-submit[bot] merged 2 commits intoflutter:mainfrom
chunhtai:issues/100933
Dec 1, 2022
Merged

[go_router] Refactors GoRouter.pop to handle pageless route#2879
auto-submit[bot] merged 2 commits intoflutter:mainfrom
chunhtai:issues/100933

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Dec 1, 2022

fixes flutter/flutter#100933

also make canPop and popRoute(android back button) to be able to pop dialog pushed to any navigator

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Comment on lines +190 to +192
/// The iterator starts with the navigator that hosts the top-most route. This
/// navigator may not be the inner-most navigator if the top-most route is a
/// pageless route, such as a dialog or bottom sheet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? Isn't it okay to have an inner Navigator with a page-backed route and a pageless route?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I understanding correctly that this function returns a Iterator<NavigatorState> in the order that maybePop() should be called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? Isn't it okay to have an inner Navigator with a page-backed route and a pageless route?

Consider this case

matchlist: [ShellRoute, GoRouteA]

user in GoRouteA and called showDialog to push a dialog to root navigator. In that case the maybepop should be call on the root navigator instead of the shellroute navigator.

Am I understanding correctly that this function returns a Iterator in the order that maybePop() should be called?

correct.

Copy link
Contributor

@johnpryan johnpryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just a few questions about the iterator

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 1, 2022
@auto-submit auto-submit bot merged commit 44fc781 into flutter:main Dec 1, 2022
@chunhtai
Copy link
Contributor Author

chunhtai commented Dec 1, 2022

also cc @ValentinVignal since you have been working on imperative API a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: go_router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go_router] ModalBottomSheet is not popped when using GoRouter.pop()

2 participants