-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Make _layoutBoundary a boolean 2 #169958
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
Make _layoutBoundary a boolean 2 #169958
Conversation
assert(() { | ||
_debugCanParentUseSize = parentUsesSize; | ||
return true; | ||
}()); | ||
|
||
_isRelayoutBoundary = !parentUsesSize || sizedByParent || constraints.isTight || parent == null; |
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.
Uhm it looks like before this patch if !_needsLayout && constraints == _constraints
is true the RenderObject can have a null _relayoutBoundary
even after layout
.
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
} | ||
if (_relayoutBoundary != this) { | ||
_needsLayout = true; | ||
if (owner case final PipelineOwner owner? when (_isRelayoutBoundary ?? false)) { |
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.
My understanding, promote owner to non-null when _isRelayoutBoundary is true
what does the question make after the owner
in case final PipelineOwner owner?
do?
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.
https://dart.dev/language/pattern-types#null-check
It's currently optional with the flutter/flutter repo enforcing type annotations everywhere, but I thought this was a good practice in case that changes (in which case it would become if (owner case final owner? when ...)
.
On a related note, I think putting type annotations everywhere is actually pretty awkward here. If the reader doesn't know the exact type of this.owner
they might think this line is trying to downcast this.owner
from a supertype of PipelineOwner?
to PipelineOwner?
. With if (owner case final owner?)
it's pretty clear that I'm just trying to check for null
.
#169638, without the more risky changes. I'll try to fix the g3 failures and land #169638 later.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.