flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.2k stars 26.64k forks source link

Improve the naming of `Menu` widgets. #116657

Open LasseRosenow opened 1 year ago

LasseRosenow commented 1 year ago

Now that the new DropDownMenu widget landet, I am a bit surprised by its name choice. It seems to be inspired by the old DropDownButton widget, but it does not really make sense in my mind.

Now we have this: Widget Description
PopupMenuButton Menu that is triggered by a Widget or Icon
DropDownMenu Menu that is triggered by an input field

What I find confusing is that Popup bs DropDown ... Is both kinda the same. But then why does DropDown mean textfield as trigger?

Use case

Confusing naming of widgets is a problem for new developers. So having more obvious names that align with the spec is good.

Proposal

In general I think the "popup" is a word that does not appear in the material spec. So why not just remove it? And then align the 2 widgets to each other: (This would be breaking, but could be done by just introducing new widgets):

Widget Description
MenuButton Menu that is triggered by a Widget or Icon
MenuTextField Menu that is triggered by an input field
MenuTextField.autocomplete Menu that is triggered by an input field and enables text input by keyboard
HansMuller commented 1 year ago

Appreciate the suggestions and agree that they're sensible and consistent. We did struggle to find an appropriate name for what had been called "ComboBox". Eventually we settled on DropdownMenu because that's what the Material Design team thought it should be called and because it's short. Naming is definitely hard, more so when you're adding a name to an ecosystem of names that's been evolving for 5+ years.

guidezpl commented 1 year ago

@HansMuller There's also PopupMenuButton/DropdownButton. The m3 guidelines effectively describe all three of these as a single component. I think it would be a lot simpler to handle the particularities (how it's opened, whether it can be filtered, searched, etc.) by parameters on a single widget, rather than have separate and different API in 3+ widgets.

flutter-triage-bot[bot] commented 2 weeks ago

This issue is missing a priority label. Please set a priority label when adding the triaged-design label.