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
166.19k stars 27.49k forks source link

Allow setting the start/opening offset of DropdownMenuItem #129820

Open bochelie1000 opened 1 year ago

bochelie1000 commented 1 year ago

Is there an existing issue for this?

Use case

DropdownButton should have the possibility to open below itself. At the moment this is not an option. See your own example: https://api.flutter.dev/flutter/material/DropdownButton-class.html In there the dropdownbutton opens above the button itself.

Proposal

PopupMenuButton has the possibility to change the starting offset. By changing the offset to 40 the PopupMenuButton opens below itself: PopupMenuButton( offset: const Offset(0, 40),

Please can you add this to DropdownButton as well? And thuse allow Dropdownbutton to open below itself.

It seems that Dropdownbutton2 from pub.dev does open as desired just below the dropdownbutton2 itself. However that is not a flutter package and thus I prefer not to use it in production apps. https://pub.dev/packages/dropdown_button2

dam-ease commented 1 year ago

Hi @bochelie1000. This seems to be about DropdownButton being customizable in which there is a currently open issue https://github.com/flutter/flutter/issues/25151, you can upvote and comment on the existing issue. Kindly confirm this suits your case as well.

bochelie1000 commented 1 year ago

My question is for a different option however, it is a customization. If it is better to add it to that question than lets do it.

flutter-triage-bot[bot] commented 1 year ago

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

QuncCccccc commented 1 year ago

Thanks a lot for filing this issue! Have you tried our M3 MenuAnchor or DropdownMenu? By customizing leadingIcon in DropdownMenu, I think we can set some offset before the leading widget:)

bochelie1000 commented 1 year ago

Thanks a lot for filing this issue! Have you tried our M3 MenuAnchor or DropdownMenu? By customizing leadingIcon in DropdownMenu, I think we can set some offset before the leading widget:)

Well, I really needed the DropDownButton because of some functionality which I cant remember now. I tried the DropdownMenu but this could not do what I want. I dont remember if I tried MenuAnchor, but I probably would because I remember trying a lot of things.

adonisRodxander commented 1 month ago

Is there any update or workaround on How to achieve this using DropdownMenu?

bochelie1000 commented 1 month ago

Only thing I know is that you should use DropdownMenu instead of DropdownButton which this question was orginaly ment for if using Material3. From what I see DropdownMenu is very nice and does automatically open to the bottom if there is space for it. It is a pity that their is little feedback on this.

See example at https://api.flutter.dev/flutter/material/DropdownMenu-class.html