-
Notifications
You must be signed in to change notification settings - Fork 48
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
Support for a scrollable LocalHero #17
Conversation
to LocalHeroScope. It makes the LocalHero animation skip all position changes except when caused by a remount. A remount is considered a reparent or a slot change inside a multi-child parent.
The LocalHero now animates due to any change in its Widget. This still filters out scrolling but enables e.g. resizing.
There is error 'package:flutter/src/rendering/object.dart': Failed assertion: line 2597 pos 12: '!_debugDisposed': is not true. |
The first error seems related to issue #5. I also have a PR for that #16. In my forked branch
Yes, you have to use a key on each local hero. Without the key, the change in position cannot be tracked. |
Thanks for this PR! I tried it by surrounding return SingleChildScrollView(
child: SizedBox(
height: 2000, I saw at least two issues, one is performance : the scroll does not seem smooth. The other one is as we scroll, the widgets are painted above the scaffold and this if we scroll too far, the are painted above the appBar. |
The first issue I did not notice because I only used a Windows PC with a GPU where I get 144 FPS. What device did you use? For the second issue you can try wrapping the |
My bad, I woke up today thinking about your PR and I remembered that I completely forgot to set |
Don't worry about it, that also happened to me multiple times during testing! 😅
Mainly backwards compatibility. But you are right this is unlikely to break any intended functionality. If there will be a short migration guide I agree with you, it can be The second smaller reason is I already have a solution for this that I will post as a follow-up PR when we reviewed this one: A |
Yeah we cam bump the version to 0.3.0 to indicate there is a possible breaking change. Can you resolve the conflict so that we can merge this PR? For the issue with slivers, can you post an example where it does not work? I made a simple test with a |
I added a new tab to the example app. To see the issue do the following:
You will see a one frame glitch where the items are in the wrong position. Another problem comes up when pressing 'Add Item'. The last visible item does not get animated off the screen, it just disappears instantly. If your idea with the keepalive fixes this let me know. I'm not sure how to test it myself- |
Oh ok I see the issue thanks, and no |
Issue #1 has a few requests for a LocalHero that works under a scrollable widget.
I think I found a working solution that should give LocalHeros the ability to skip their animation when scrolling.
It adds the
onlyAnimateRemount
parameter to theLocalHeroScope
constructor.Set it to
true
and the LocalHeros in this scope wont animate unless their widget in the widget tree and their position on screen changed.This will at least work with
SingleChildScrollView
scrollables because these don't do tree surgery.Before & after videos
Before:
After: