Skip to content

Fix DropdownMenu default width does not take label into account - #161219

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
NevercodeHQ:fix_DropdownMenu_default_width_does_not_take_label_into_account
Feb 13, 2025
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
NevercodeHQ:fix_DropdownMenu_default_width_does_not_take_label_into_account

Conversation

@bleroux

@bleroux bleroux commented Jan 7, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes DropdownMenu default width when a long label is provided.

Before:

The width is based on the longest menu item (which can be smaller than the label):

image

After:

The width also depends on the label width when it is longer than the menu items.

image

Related Issue

Fixes DropdownMenu default width does not take label into account

Tests

Adds 2 tests.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Jan 7, 2025
@bleroux
bleroux requested a review from justinmc January 7, 2025 13:16
@bleroux
bleroux requested a review from QuncCccccc January 14, 2025 14:17
@bleroux
bleroux requested a review from QuncCccccc January 15, 2025 15:38

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for the improvement:) Let's see whether there's any luck on Google testing🤞

@bleroux
bleroux force-pushed the fix_DropdownMenu_default_width_does_not_take_label_into_account branch from 11702a0 to 99ddf8a Compare January 22, 2025 08:28
@bleroux

bleroux commented Jan 22, 2025

Copy link
Copy Markdown
Contributor Author

@QuncCccccc Unfortunately some Google tests are failing, thanks in advance for checking how many tests are failing and if they can be updated.

@QuncCccccc

Copy link
Copy Markdown
Contributor

Sorry for the late response. Will take a look at the google testing.

@QuncCccccc

Copy link
Copy Markdown
Contributor

There is a a11y test breaking in Google testing. Will fix it today. Thank you for your patience!

(Widget item) => ExcludeFocus(excluding: !controller.isOpen, child: item),
),
if (widget.label != null)
Padding(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add ExcludeSemantics here? I think this can fix the failure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great, it worked out!
Thanks for having investigated those Google test failures 🙏

@bleroux
bleroux force-pushed the fix_DropdownMenu_default_width_does_not_take_label_into_account branch from 99ddf8a to 5e08c56 Compare February 13, 2025 08:27
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 13, 2025
@auto-submit
auto-submit Bot added this pull request to the merge queue Feb 13, 2025
Merged via the queue into flutter:master with commit b61335b Feb 13, 2025
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 13, 2025
@bleroux
bleroux deleted the fix_DropdownMenu_default_width_does_not_take_label_into_account branch February 13, 2025 10:59
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

Development

Successfully merging this pull request may close these issues.

DropdownMenu default width does not take label into account.

2 participants