hiding original hero after hero transition#37341
Conversation
|
cc @Piinks |
There was a problem hiding this comment.
Why change the name here? 'placeheld' seems a bit more ambiguous to understanding that the hero is currently flying.
There was a problem hiding this comment.
This pr make it so after hero transition finishes, the hero widget in the original route will still be hidden. The placeheld (or isHeroInFlight previously) is controlling whether to hide the hero. After this change, we want to hide hero even if it is not in flight. I feel the name become confusing, and that is why i renamed it. I am open to any name suggestion tho
There was a problem hiding this comment.
Maybe a better name would be: showPlaceholder?
There was a problem hiding this comment.
Can you elaborate further about what this means?
There was a problem hiding this comment.
one of the hero should be hidden after the flight, when AnimationStatus.completed toHero will be the one on top, if AnimationStatus.dismissed, it means it starts transition but got canceled, so the fromHero will be the one on top
There was a problem hiding this comment.
I will update the comment
goderbauer
left a comment
There was a problem hiding this comment.
I am not sure if anybody depends on those heroes becoming visible again, but for those people, this will be a nasty breaking change. Nasty, because their app will just compile fine and run without exceptions. It'll be hard for them to notice that something is broken. Again, I can't think of any reason for anybody to depend on the fact that the heroes in the route below become visible again, but if we want to do this as a breaking change, we should collect feedback by sending out a breaking change proposal and giving people some time to respond. The breaking change should also be clearly stated in the PR description.
We could also make this a non-breaking change by just having it as a config option on the hero and defaulting it to the current behavior.
There was a problem hiding this comment.
Not sure what this comment means?
There was a problem hiding this comment.
Add documentation what placeheld means?
There was a problem hiding this comment.
Maybe the parameter should be named: keepPlaceholder.
There was a problem hiding this comment.
Can this get a more descriptive name? Maybe "ensurePlaceholderIsHidden"?
There was a problem hiding this comment.
Maybe a better name would be: showPlaceholder?
There was a problem hiding this comment.
Do you have tests for both of these cases?
There was a problem hiding this comment.
hide? fromHero is already hidden and we just keep it hidden, no?
There was a problem hiding this comment.
Do you have a test for this case?
There was a problem hiding this comment.
Also: why's the from hero placeheld?
There was a problem hiding this comment.
I don't think this will matter because the old heros are disposed, and it will not be testable because the elements are gone. I modify this just to be extra safe
There was a problem hiding this comment.
If it doesn't matter, I'd remove the comment. The comment makes it sound like that this is super-important.
There was a problem hiding this comment.
Again, why do we hide them in this case?
I am struggle on whether to keep the original behavior. I think if we want to provide options, they will be either the fromHero is always displayed or the always hidden. The current behavior is just weird and ugly. |
There was a problem hiding this comment.
| // The 'keepPlaceholder' flag dictates if the hero should keep the placeholder after | |
| // When `keepPlaceholder` is true, the placeholder will continue to be shown after the flight ends. |
There was a problem hiding this comment.
If it doesn't matter, I'd remove the comment. The comment makes it sound like that this is super-important.
You can collect feedback for this by sending out a proposal for this breaking change and we can add options if people depend on this. |
25d50d8 to
626a6b3
Compare
There was a problem hiding this comment.
This should probably be guarded by if (mounted) and the if mounted should be removed from endFlight?
Is there any option or workaround to make the original hero always visible? |
|
@liuyingshan |

Description
If you transition for route 1 to route2, the hero in route1 is hidden during the transition and reappear after transition end. This is generally ok when route2 is not transparent, but looks weird when it is transparent.
after this pr it will hide the original hero
Related Issues
#10667
Tests
I added the following tests:
"Heroes animate should hide original hero"
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?