New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to limit size of DropDown from DropDownButton #23865
Comments
Please elaborate more what this request is about. |
Please add the output of |
This is a reasonable request. By default, DropdownButton's menu shows as many items as will fit modulo a little padding above and below. It would be useful to be able to provide a limit. Could be: number of items, menu height, menu height as a percentage of the available space. If the dropdown's menu is going to scroll, it's helpful if the height limit is not a whole number of items. A partially visible item at the bottom of the menu is a reminder that the menu is scrollable. |
@HansMuller While at it, we should add limitations for the distance the opened menu is from top or bottom. A problem I am having is as follows: |
If |
Most probably you are right that it should work with a standart |
@HansMuller I tried wrapping However, the |
In the case 5km/10km/etc case above the dropdown menu just doesn't fit within the SafeArea. I think what's needed is for the menu's size to reflect the safe area's limits (not the screen's limits). Will look into this. Thanks for the excellent illustration of the problem BTW! |
@HansMuller Thank you for answering so quickly. I will leave them as they are for now and work on building other stuff. I am sure a solution will emerge since you are handling it. Can't wait |
Ordinarily the dropdown button's menu appears in a route that appears on top of the BottomNavigationBar etc. Here's a simple test case: https://gist.github.com/HansMuller/4444359b7a06df9593004173bc639949 Your case looks considerably more complex? Can you provide a test case that demonstrates the problem? |
Is there another issue that tracks a request to adjust or limit the max height for a DropdownButton. We would like to track the progress of such a change, if it's already planned. |
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! |
@wprater we also have an issue with the default behavior consuming the entire screen, minus a little vertical padding, which makes it difficult to dismiss. We really need a means to control the dropdown area of this Widget |
@sathishRA91 can you please re-open this issue, it has not been fixed. @CoreyCole's answer is a workaround, but I think a proper fix is necessary in Flutter. |
Do we have a proper fix to this issue? I agree with @tudor07 what @CoreyCole suggested is just a workaround. |
Still not solved huh ? oh well.. |
ye pls add the option to set expanded height |
custom dropdown widget is here : |
Brother, simply use containers with margin and paddings and use isExpanded to true. Code given below:
|
Since I wanted to maintain a minimum distance from the top the screen instead of a fixed height, I modified diegodeveloper's custom_dropdown to accept a minimum offset value from the top of the screen. Just download the dart file from link Usage is the similar to diegodeveloper's import 'custom_dropdown.dart' as custom;
Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Container(
padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
child: Form(
child: ListView(
scrollDirection: Axis.vertical,
children: <Widget>[
//other widgets here
custom.DropdownButtonFormField(
offsetAmount: 150.0,
items: this.dropDownItems
),
],
),
)),
); Don't forget to add the alias also in your DropdownMenuItem like this : custom.DropdownMenuItem(
child: Text("Sample Tex"),
value: "any_value",
), |
still open!!! |
No solutions for this? |
Is there any estimation by when we can see a proper solution? |
I am able to solve it by changing the copy of DropDown and change this line to something like: |
I can't believe this is still open |
Having the same issue here.. |
Some problem here... 😭 |
Any ETA? How can it take 2 years to add a simple height when the community already added the code for it? |
Flutter is getting a bad reputation because of such issues. It's been so long. |
Has there been any form of acknowledgement of this issue? As a new Flutter dev, Having to use custom components for such a simple issue isn't encouraging at all. |
2 year anniversary of this issue |
I faced this issue a year ago, faced it again. But here, this issue is open for 2 years. |
I am facing this issue, is this issue solved or not? |
Are there any updates on this? |
maybe this week. |
#76493 has a PR ready that should allow users to limit the size of the menu, if anybody wants to take a look and see |
More than 2 years to wait for a simple feature.. From one of the most famous software development kit, it's strange that this kind of basic features are not included. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
i have long list its fill the window when click the DropDownButton. Is it possible to limit the suggestionsAmount in DropDownButton view
The text was updated successfully, but these errors were encountered: