Skip to content

Conversation

@sharmashashi
Copy link
Contributor

@sharmashashi sharmashashi commented Feb 7, 2023

This PR wraps the label with IntrinsicWidth and then Flexible which allows DefaulTextStyle TextOverflow.ellipsis to work. Wrapping label directly with Flexible brings more space between icon and label. IntrinsicWidth fixes this by giving reasonable width.

Fixes #112163

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Feb 7, 2023
@flutter-dashboard
Copy link

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 HansMuller self-requested a review February 17, 2023 23:31
Copy link
Contributor

@HansMuller HansMuller left a 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))
Copy link
Contributor

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.

Copy link
Contributor Author

@sharmashashi sharmashashi Mar 2, 2023

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?

Copy link
Contributor

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(
Copy link
Contributor

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,
                  ...

Copy link
Contributor

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);
Copy link
Contributor

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

),
),
);

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@HansMuller
Copy link
Contributor

I've checked this against the internal tests, see (google internal link) cl/513379794. All appears to be well.

Copy link
Contributor

@HansMuller HansMuller left a 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))
Copy link
Contributor

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(
Copy link
Contributor

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.

),
),
);

Copy link
Contributor

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.

@github-actions github-actions bot removed the framework flutter/packages/flutter repository. See also f: labels. label May 24, 2023
@flutter-dashboard
Copy link

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 package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jun 26, 2023
@sharmashashi sharmashashi requested a review from HansMuller August 6, 2023 03:11
@HansMuller
Copy link
Contributor

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.

@goderbauer
Copy link
Member

(triage) @sharmashashi Do you still have plans to come back to this and address the feedback given above?

@sharmashashi
Copy link
Contributor Author

(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.

@sharmashashi
Copy link
Contributor Author

@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 The reviewer should also verify your golden image(s), so make sure to include the golden(s) in your PR description.
I was also reading the conversation from an old PR. I was wondering if these steps are still being followed.

@flutter-dashboard
Copy link

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 package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #120206 at sha ff11944

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Dec 14, 2023
Copy link
Contributor

@HansMuller HansMuller left a 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!

@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 14, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 14, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Dec 14, 2023

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.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MitchellGoodwin MitchellGoodwin added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 14, 2023
@auto-submit auto-submit bot merged commit cf3ed1e into flutter:master Dec 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 15, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Dec 15, 2023
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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BottomNavigationBarItem label overflow with BottomNavigationBarLandscapeLayout.linear

5 participants