-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix BottomNavigationBarItem label overflow #120206
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
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
HansMuller
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.
This looks OK, assuming that it doesn't break any existing layouts. Running a large internal test suite now to check.
| children: <Widget>[ | ||
| icon, | ||
| const SizedBox(width: 8), | ||
| Flexible(child: IntrinsicWidth(child: label)) |
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.
A comment that explains what this unusual combination of widgets is for would be helpful here.
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.
Okay. Defining what Flexible and IntrinsicWidth does for the label would be fine, right?
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's pretty obvious what <Widget>[icon, const SizedBox(width: 8), label] means however it's not obvious what wrapping label in Flexible and IntrinsicWidth widgets is intended to accomplish in the new version. Which is to say, "yes" :-)
| home: Builder( | ||
| builder: (BuildContext context) { | ||
| return Scaffold( | ||
| bottomNavigationBar: BottomNavigationBar( |
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.
The two-space indentation needs to be fixed up here.
builder: (BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
landscapeLayout: BottomNavigationBarLandscapeLayout.linear,
...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 looks like line 2500 still needs to be backed up two spaces.
| }); | ||
|
|
||
| testWidgets('BottomNavigationBar linear landscape layout label RenderFlex overflow',(WidgetTester tester) async { | ||
| tester.binding.window.physicalSizeTestValue = const Size(540, 340); |
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.
Please insert a comment here:
Regression test for https://github.com/flutter/flutter/issues/112163| ), | ||
| ), | ||
| ); | ||
|
|
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.
Shouldn't this test be verifying that the expected ellipsis suffixes have appeared?
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 am not sure because the ellipsis was already applied, should we verify that the overflow property is TextOverflow.ellipsis? Can you please guide me with this?
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 you need to verify that the "..." suffix actually appears as expected.
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 don't know how to verify that. I have looked into it and couldn't find any way except golden test. The current test verifies that there will be no render overflow. I am kind of stuck here.
|
I've checked this against the internal tests, see (google internal link) cl/513379794. All appears to be well. |
HansMuller
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.
Sorry, I lost track of this one. In addition to the feedback, it looks like there are analyzer failures to fix up.
You can check for analyzer errors locally with flutter analyze --flutter-repo
| children: <Widget>[ | ||
| icon, | ||
| const SizedBox(width: 8), | ||
| Flexible(child: IntrinsicWidth(child: label)) |
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's pretty obvious what <Widget>[icon, const SizedBox(width: 8), label] means however it's not obvious what wrapping label in Flexible and IntrinsicWidth widgets is intended to accomplish in the new version. Which is to say, "yes" :-)
| home: Builder( | ||
| builder: (BuildContext context) { | ||
| return Scaffold( | ||
| bottomNavigationBar: BottomNavigationBar( |
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 looks like line 2500 still needs to be backed up two spaces.
| ), | ||
| ), | ||
| ); | ||
|
|
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 you need to verify that the "..." suffix actually appears as expected.
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
I asked around and it turns out it actually is difficult to programmatically verify that the ellipsis has been included at the end of text. So in this case creating a golden image test is warranted. See Writing a golden file test for package:flutter. Looks like the presubmit bots have some issues as well. |
|
(triage) @sharmashashi Do you still have plans to come back to this and address the feedback given above? |
Yes, I do. I will look into this within a week and let know if I can continue with the golden test. |
|
@HansMuller I write the golden test. I read the guide on creating the new golden file test but I did not understand how to include golden(s) in PR description as stated |
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
HansMuller
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 sorting out how to write a golden file test!
|
auto label is removed for flutter/flutter/120206, due to This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.
|
MitchellGoodwin
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!
flutter/flutter@a51e33a...2407f69 2023-12-15 [email protected] Move package:web dependency to dev dependency (flutter/flutter#139696) 2023-12-15 [email protected] Roll Flutter Engine from 9524a185b055 to 986a6fe198dc (1 revision) (flutter/flutter#140221) 2023-12-15 [email protected] Roll Packages from 1151191 to 3f2e16b (9 revisions) (flutter/flutter#140218) 2023-12-15 [email protected] Roll Flutter Engine from 7a50221733c2 to 9524a185b055 (1 revision) (flutter/flutter#140217) 2023-12-15 [email protected] Roll Flutter Engine from 767223f7a4f8 to 7a50221733c2 (1 revision) (flutter/flutter#140216) 2023-12-15 [email protected] Roll Flutter Engine from 91f65eea0c11 to 767223f7a4f8 (1 revision) (flutter/flutter#140210) 2023-12-15 [email protected] Roll Flutter Engine from a47da28c9a62 to 91f65eea0c11 (1 revision) (flutter/flutter#140207) 2023-12-15 [email protected] Roll Flutter Engine from cde1a596432d to a47da28c9a62 (1 revision) (flutter/flutter#140204) 2023-12-15 [email protected] Roll Flutter Engine from 46ff5c08a905 to cde1a596432d (1 revision) (flutter/flutter#140200) 2023-12-15 [email protected] Roll Flutter Engine from a17bb0a63b7e to 46ff5c08a905 (1 revision) (flutter/flutter#140198) 2023-12-15 [email protected] Roll Flutter Engine from 4cb3ba7a85f6 to a17bb0a63b7e (1 revision) (flutter/flutter#140196) 2023-12-15 [email protected] Roll Flutter Engine from 0e7248d43251 to 4cb3ba7a85f6 (14 revisions) (flutter/flutter#140195) 2023-12-15 [email protected] Increase versions of leak tracker libraries. (flutter/flutter#140018) 2023-12-15 [email protected] Set compile test iOS app target version to not embed Swift runtime (flutter/flutter#140188) 2023-12-15 [email protected] Cupertino text clear label (flutter/flutter#129727) 2023-12-15 [email protected] [github actions] use token from real user flutter mirror bot (flutter/flutter#140191) 2023-12-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from 0e7248d43251 to 0b0fab821536 (4 revisions)" (flutter/flutter#140194) 2023-12-14 [email protected] Roll Flutter Engine from 0e7248d43251 to 0b0fab821536 (4 revisions) (flutter/flutter#140180) 2023-12-14 [email protected] feat: Add onTapAlwaysCalled in TextFormField (flutter/flutter#140089) 2023-12-14 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 3.1.3 to 4.0.0 (flutter/flutter#140177) 2023-12-14 [email protected] Roll Flutter Engine from 2140942444ea to 0e7248d43251 (2 revisions) (flutter/flutter#140176) 2023-12-14 [email protected] fix reorderable_list drop animation (flutter/flutter#139362) 2023-12-14 [email protected] Roll Flutter Engine from 997d3dfa1e74 to 2140942444ea (4 revisions) (flutter/flutter#140171) 2023-12-14 [email protected] Fix BottomNavigationBarItem label overflow (flutter/flutter#120206) 2023-12-14 [email protected] Roll Flutter Engine from a565cea256c7 to 997d3dfa1e74 (2 revisions) (flutter/flutter#140170) 2023-12-14 [email protected] Revert "Dynamic view sizing" (flutter/flutter#140165) 2023-12-14 [email protected] �: fix cupertionActionSheet design (flutter/flutter#134345) 2023-12-14 [email protected] Make improvements to existing new issue templates (flutter/flutter#140142) 2023-12-14 [email protected] Roll Flutter Engine from caf33276468b to a565cea256c7 (1 revision) (flutter/flutter#140163) 2023-12-14 [email protected] Expand and update a few release.yml categories (flutter/flutter#140120) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR wraps the
labelwithIntrinsicWidthand thenFlexiblewhich allows DefaulTextStyleTextOverflow.ellipsisto work. Wrappinglabeldirectly withFlexiblebrings more space betweeniconandlabel.IntrinsicWidthfixes this by giving reasonable width.Fixes #112163
Pre-launch Checklist
///).