-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[go_router] [shell_route] Add observers parameter #2664
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
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @angjelkom , are you still planning to work on this pr? |
Apologize, yes I will add your suggested change over the weeekend. I've been busy with work. |
@chunhtai I will need a bit more time, as merging the latest commits from the main branch caused my example to have weird side-effects where the Hero animation doesn't work when going to the next page but when going back it works in a buggy-weird way. So until i solve that I can't commit the change for HeroControllerScope. |
efd5ca8
to
4011341
Compare
@angjelkom are still planning on coming back to this pr? |
@chunhtai Sorry I am too busy at the moment with work, I will for sure complete it by the end of next week! |
@angjelkom I will take a look at the issue and try to resolve it asap |
@angjelkom, the issue you mentioned has been fixed. Could you update your PR for merging? If you are too busy, I could create an analogic PR. I need it solely for |
@ycherniavskyi yes saw the merge today, I will proceed with completing the PR |
4b28692
to
f11123d
Compare
@ycherniavskyi the PR is ready waiting for @chunhtai to review it and approve it. |
f11123d
to
915f6b2
Compare
any chance this will get merged soon? |
@arsen I will get on it tonight to finish it up. |
@chunhtai as @ycherniavskyi suggested we should use the relevant HeroController based on whether MaterialApp or CupertinoApp is used, in order to do that we need to use the RouteBuilder not the ShellRoute in order to access the context. The issue is because the RouteBuilder gets rebuild while navigating the HeroController which again breaks the animation, the way I see it we have two options: Option 1: Create 3 final variables in the RouteBuilder, one using createMaterialHeroController, one using createCupertinoHeroController and a default HeroController. Option 2: Have a heroController parameter to the ShellRoute so that the user passes one himself. Let me know what would you recommend, I can do the change tonight. |
As I understand, the last barrier before merging is extending the hero controller test. @chunhtai am I correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I just got back from vacation.
correct |
When will this be merged? |
Hi @angjelkom, it looks like @flodaniel has provided a test, can you commit to this pr so that i can merge it? |
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com>
516bfef
to
544fd68
Compare
544fd68
to
c34d480
Compare
@flodaniel Thanks a lot for the test! @chunhtai merged it, but at the moment submit-queue check is failing for some other reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hello everyone! Is there any prediction of when it will be merged? |
…ng a `ShellRoute` with `observers` (#5563) [This pr](#2664) added the ability to provide a list of `NavigatorObservers` to a `ShellRoute`. The equivalent was never added to `go_router_builder`, so this pr provides that functionality. This is a workaround to [this issue](flutter/flutter#112196) where navigator observers added to a `GoRouter` at the top level do not fire in `ShellRoutes`. With this change, you can provide `NavigatorObservers` directly to the `ShellRoute`
This PR adds
observers
parameter to theShellRoute
and passes that to the nested Navigator created by that sameShellRoute
.The need for this PR is because it fixes cases where a
Hero
animation doesn't work when used with nested navigation and it requires aHeroController
to be used as an observer for that nested Navigator.fixes flutter/flutter#112095
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.