-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Fix: Focus on leading icon when null #164966
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Thanks a lot for your contribution. Looks like the CLA is missing. Could you follow the comment above to sign the CLA so we can move forward:)
-- UPDATE:
Just noticed the CLA has been signed! Thanks!
@@ -1099,7 +1099,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> { | |||
child: DefaultTextStyle(style: effectiveTextStyle!, child: widget.label!), | |||
), | |||
), | |||
trailingButton, | |||
ExcludeSemantics(excluding: widget.leadingIcon == null, child: trailingButton), |
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.
Why do we wrap trailingButton
with ExcludeSemantics when leadingIcon
is 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.
I think a better solution for this would be:
- Implement
visitChildrenForSemantics
in_DropdownMenuBody
. - All children in
DropdownMenuBody
are used for a measurement purpose, except the first childtextField
. So in the method, we can just visit the first child for its semantics and then skip the rest of them.
The method can look like this:
@override
void visitChildrenForSemantics(RenderObjectVisitor visitor) {
visitChildren((RenderObject renderObjectChild) {
final RenderBox child = renderObjectChild as RenderBox;
if (child == firstChild) {
visitor(renderObjectChild);
}
return;
});
}
- Please also add a comment above this method to explain why we skip all the children except the first one. Something like: // Children except the text field (first child) are laid out for measurement purpose but not painted.
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.
@QuncCccccc Hey, thanks for the suggestion. Have made changes accordingly, do check and let me know if I missed something. Thank you.
1f86f83
to
ad1e07b
Compare
ad1e07b
to
cdf25e3
Compare
Fix: Focus on leading icon when null
fixes: #164905
Pre-launch Checklist
///
).