DropDownButton is a flutter Widget that creates the Select-Option Menu
Questions tagged [dropdownbutton]
201 questions
74
votes
22 answers
Flutter: There should be exactly one item with [DropdownButton]'s value
I am trying to create a dropdown button in Flutter. I am getting a List from my database then I pass the list to my dropdownButton everything works the data is shown as intended but when I choose an element from it I get this error:
There should be…

Abdelbaki Boukerche
- 1,602
- 1
- 8
- 20
18
votes
5 answers
Set default value for dropdown button in flutter
I have a dropdown button which works fine, but when I try to set a default value it will fail with the following error:
'package:flutter/src/material/dropdown.dart': Failed assertion: line 620 pos 15: 'items == null || items.isEmpty || value ==…

Alexandra Damaschin
- 761
- 3
- 13
- 28
12
votes
1 answer
InputDecoration errorText must be constant
[dart] Invalid constant value.
[dart] Arguments of a constant creation must be constant expressions.
I want to make DropdownButton , but errorText only accept constant variable.
[dart] Invalid constant value.
[dart] Arguments of a constant creation…

gersur
- 187
- 3
- 10
9
votes
2 answers
type 'List' is not a subtype of type 'List>'
Im working on a flutter project where i pass an array of objects (List> array) to the stream-builder from my bloc. If i print the object it prints nicely, but when i try to map them out in the DropdownMenuItem, it throws me the mentioned error.…

danu
- 1,079
- 5
- 16
- 48
8
votes
3 answers
Flutter DropdownButton widget with Getx
I'm in the process of learning GetX state management and stumble upon the DropdownButton widget. How do I update the selected value with the selected value cannot be observed. Here is my DropdownButton widget
DropdownButton(
…

Hanis
- 309
- 1
- 6
- 15
8
votes
7 answers
How to change height of DropdownButton in flutter
How can I change the height of a DropdownButton in flutter.
I have tried to use Padding and SizedBox but none is realy working.
SizedBox just increases the container size while the DropdownButton is clamped to top left and therefore is not centered…

Code Spirit
- 3,992
- 4
- 23
- 34
6
votes
3 answers
How to reset value in Flutter DropdownButtonFormField
I want to reset value at DropdownButtonFormField, value is changed to null, but DropdownButtonFormField doesn't change. Where is the problem? If I have used DropdownButton it was changing value properly, value was cleared. I need to use…

Maroshb
- 63
- 1
- 3
6
votes
3 answers
Flutter DropdownButton - Add title for separating items
Im trying to implement a DropdownButton that can separate specific items from each other with a title (see desired output on image below, the titles are in green)
Like in the example I would like to add these green titles to my existing…

DoobieAsDave
- 1,034
- 3
- 12
- 22
6
votes
2 answers
Flutter: Change background color of DropDownMenuItems pick list
In the following example the DrowdownButton contains a grey background (defined by the container box decoration) with white text. The menu items therefore all have white text by default. However the menu pick list contains a white background, hence…

plam
- 313
- 1
- 4
- 17
6
votes
2 answers
DropdownButton value is not updating after selecting values from DropdownItems. How to update default value with selectedValue?
DropdownButton Value does not update even after selecting different items.
If default value is null then error message is shown and if I pass any default value (not null) then it never changes to other selected values.
currentCategory is set as…

Ketul Rastogi
- 163
- 2
- 9
5
votes
0 answers
DropdownButton options are displayed too high after hiding the keyboard
When I touch a DropdownButton, the options are displayed in the correct position, like in this image. But if I touch the last TextFormField and then touch the DropdownButton the options show up too high, like in this image.
Here is my code:
class…

Agustín Walter
- 51
- 3
5
votes
1 answer
How to make flutter custom drop down button?
I want to Customise DropDownButton, so that it does not render the content of DropdownItem. Instead it should render my Custom layout/widget before and after selecting an item from DropDown.
In simple Words, I want to customise my…

Kyaw Tun
- 12,447
- 10
- 56
- 83
4
votes
2 answers
How to set dropdown selected item into TextFormField in Flutter
I created dropdown in TextFormField in flutter, i successfully loaded list (bankDataList) into dropdown which is dynamic list. Data is showing into dropdown list. But i have a problem to assign
"value : _bankChoose" into DropDownButton , it is not…

Rakesh Saini
- 660
- 2
- 7
- 20
4
votes
2 answers
How to set different value instead of items's value in DropdownButton in flutter?
I want to achieve different values behind the scene, for example, if the user selects "United State of America" behind the scene I want a value "USA" only. How can I achieve this?
Here is my button:
DropdownButton(
…

Sunil Timilsina
- 71
- 5
4
votes
3 answers
Customizing the popup menu of a DropdownButton
How can you set the background color of the DropdownButton menu. I can customize the Text() items that appear but they appear within a container which I would like to change the color for.

AlanKley
- 4,592
- 8
- 40
- 53