-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix: Focus on leading icon when null #164966
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
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!
| ), | ||
| ), | ||
| 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
visitChildrenForSemanticsin_DropdownMenuBody. - All children in
DropdownMenuBodyare 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
QuncCccccc
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:)Thanks for your contribution!
justinmc
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 👍
|
I think this change failed google testing. I'll take a look:) |
|
@QuncCccccc ok, thank you :) |
|
@QuncCccccc have you taken a look at the test failures? (from triage) |
|
Added a g3fix: cl/745420367 to this PR. |
Fix: Focus on leading icon when null fixes: flutter#164905 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
Fix: Focus on leading icon when null
fixes: #164905
Pre-launch Checklist
///).