Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented Feb 23, 2018

By default dropdown menus are wider than their dropdown button: 16.0 pixels wider on the left, and 24.0 pixels wider on the right.

Setting ButtonThemeData.alignedDropdown to true makes dropdown menus the same width as their button. The button's label is padded 16.0 on the left so that the button and menu item labels line up.

new ButtonTheme(
  alignedDropdown: true,
  child: new DropdownButton( ... ),
)

Fixes #14785

@HansMuller HansMuller changed the title Make dropdown geometry more flexible [WIP not for review] Enable aligning a dropdown button's width with its menu's width Mar 2, 2018
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add something like "has no effect on buttons other than [DropdownButton]" or something?

@Hixie
Copy link
Contributor

Hixie commented Mar 6, 2018

LGTM if you decide this is the right solution.

@HansMuller
Copy link
Contributor Author

I do think this is the right solution. It's backwards compatible, since by default dropdown menu geometry doesn't change. And it makes it simple to enable the new and improved menu geometry with the material theme's button theme.

@HansMuller HansMuller merged commit e1c38aa into flutter:master Mar 7, 2018
@HansMuller HansMuller deleted the dropdown_width branch March 7, 2018 20:14
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
@jhionan
Copy link

jhionan commented Jul 11, 2019

Thank you for this PR, but next time please use a nicer commit messages, checkpoint is not a commit!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DropdownMenuItem widget is wider than the Dropdown itself

4 participants