Repository navigation
Workaround rounding erros in cupertino nav bar transition - #88935
Conversation
jmagman
left a comment
There was a problem hiding this comment.
Can't review whether this framework-y code is idiomatic, but the Dart code LGTM.
Resulting video really LGTM!
| } | ||
| } | ||
|
|
||
| class _PositionedAnchorTransition extends AnimatedWidget { |
There was a problem hiding this comment.
Could this class use a comment to explain what "positioned anchor" means in this context?
| child.layout(childConstraints, parentUsesSize: true); | ||
|
|
||
| late final double x; | ||
| final double x; |
There was a problem hiding this comment.
How does this work as a final if x is set a few lines below?
There was a problem hiding this comment.
My guess is final double x only declares the variable, and the compiler/analyzer is smart enough to determine that there's nothing using x before it gets initialized in the if clauses.
| hasVisualOverflow = true; | ||
|
|
||
| late final double y; | ||
| final double y; |
There was a problem hiding this comment.
one thing to add a test for: if in page 1 the content widget is font size 10 and in page 2 it's size 20, and the text animates from a smaller size to a bigger size, if in page 2, it doesn't wrap at the end, we'd want to make sure it never wraps at any point in the transition.
There was a problem hiding this comment.
If the transition starts from page 1 and the text has a font size of 10, then during the transition the text widget will always be given the same width constraint that's just enough for the max intrinsic width of the text when the font size is 10 right? If the font animates to size 20 then it's guaranteed to wrap?
There was a problem hiding this comment.
Going through the bug, it seems like this wasn't the issue. Would still be nice to address separately (since the beginning state isn't wrapped, the end state isn't wrapped either, but the transition might be wrapped). But otherwise the PR LGTM to fix the rounding issue
There was a problem hiding this comment.
During the animation the font size can change, and in the case where the font size gets larger but the container is still able to provide enough horizontal space the text shouldn't wrap?
As I understand it during the animation the middle widget has a start size but does not typically have an end size:
return slideFromLeadingEdge(
fromKey: bottomComponents.middleKey,
fromNavBarBox: bottomNavBarBox,
toKey: topComponents.backLabelKey,
toNavBarBox: topNavBarBox,
So the middle widget moves to align with the backLabelKey widget when the animation completes and it's not given a size.
…ng-erros-in-cupertino-nav-bar-transition
ce7c3cd to
b2460e1
Compare
Guarantees the incoming constraints of the middle widget are always the same during the transition.
screencasts (in RTL)
before.mp4
after.mp4
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.