-
Notifications
You must be signed in to change notification settings - Fork 29.7k
AnimatedCrossFade layout customisation #11343
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
yjbanov
left a comment
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
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.
Should we also _controller.stop()?
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.
done
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.
_controller.stop()?
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.
ah yeah good point
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.
merged these two blocks together and just made the layout use elvis:
if (child == null || constraints.isTight) {
_controller.stop();
size = _sizeTween.begin = _sizeTween.end = constraints.smallest;
_state = RenderAnimatedSizeState.start;
child?.layout(constraints);
return;
} 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.
unrelated to changes in this PR: I wonder if the existence of this subclass causes the AOT compiler to believe that Size is polymorphic and makes it slower than it could be.
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.
s/object/box/?
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.
It would make the later text confusing ("this second render object" wouldn't be as obvious), so I've left it as object.
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.
nit: optimizations
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.
fixed throughout the file
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'd add `See [AnimatedCrossFade.defaultLayoutBuilder] for an example implementation'.
I also wonder if the keys should be uniquely generated GlobalKeys instead, thus allowing more interesting layouts than those based on multiple children. In fact, I wonder if we would need to pass the keys here at all if they are GlobalKeys?
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.
We want to avoid using global keys if at all possible. They're expensive.
You can always convert a LocalKey to a GlobalKey if you really need a global key on the receiving end.
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.
added your suggested text
Actually, i've just put in some sample code instead.
* Optimise AnimatedSize for the tight case. * Remove `default` from a switch statement over enum (so that analyzer will complain if we add enum values). * Adopt the Size since we use it after the child may have changed (which would throw normally). * AnimatedCrossFade.layoutBuilder
|
updated. will land on green, if it ever goes green. |
This reverts commit 1f08bda.
defaultfrom a switch statement over enum (so that analyzer will complain if we add enum values).