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. |
| ), | ||
| ), | ||
| trailingButton, | ||
| ExcludeSemantics(excluding: widget.leadingIcon == null, child: trailingButton), |
There was a problem hiding this comment.
Why do we wrap trailingButton with ExcludeSemantics when leadingIcon is null?
There was a problem hiding this comment.
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.
@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.
LGTM:)Thanks for your contribution!
|
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
///).