-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Aborted Hero push transitions should retrace their flight path #12203
Conversation
I need to think about this some more to have a coherent comment, but my first reaction is that I'm reluctant to remove the "always forward" invariant. |
I've revised the implementation to preserve the "always animate hero flights forward' invariant. That produced a nice simplification. Added ReverseTween to tweens.dart. |
4f427c7
to
9db4cd8
Compare
@@ -178,6 +178,22 @@ class Tween<T extends dynamic> extends Animatable<T> { | |||
String toString() => '$runtimeType($begin \u2192 $end)'; | |||
} | |||
|
|||
/// An [Tween] that evaluates its [parent] in reverse. |
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.
A, not An
final RenderBox finalRouteBox = manifest.toRoute.subtreeContext?.findRenderObject(); | ||
final Offset finalHeroOrigin = finalHeroBox.localToGlobal(Offset.zero, ancestor: finalRouteBox); | ||
if (finalHeroOrigin != heroRect.end.topLeft) { | ||
final Rect heroRectEnd = finalHeroOrigin & heroRect.end.size; |
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.
I don't feel super strongly about this but I think we should probably revert these back to using the word "to" instead of "final" so that they match "toHero".
_proxyAnimation.parent = new ReverseAnimation(newManifest.animation); | ||
|
||
heroRect = _doCreateRectTween(heroRect.end, heroRect.begin); | ||
heroRect = new ReverseTween<Rect>(heroRect); | ||
} else if (manifest.type == _HeroFlightType.pop && newManifest.type == _HeroFlightType.push) { | ||
// A pop flight was interrupted by a push. | ||
assert(newManifest.animation.status == AnimationStatus.forward); |
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.
add a TODO on this side to mention that we need to fix this too
|
||
await tester.pump(duration * 0.1); | ||
expect(tester.getTopLeft(find.byKey(secondKey)).dx, closeTo(x0, epsilon)); | ||
|
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.
you should probably add a comment for lines 1190 to 1200 (checking x3...x0) that while this is our current expectation, it's not as important as the test for x4. As in, we definitely don't want x4 to regress, because that would mean the hero lept, but it's not as critical that the path be consistent on the way back, so long as it is smooth and pretty.
9db4cd8
to
b8483eb
Compare
Fix the animation jank that occurs when a push hero transition is popped before the transition has completed.
A similar fix should be made for the less common variation: a pop is interrupted by a push. This PR is incremental progress :-).