I have a DropdownButton that when it’s open looks like this.
Is it possible to make it narrower to adjust to the text?
This is my DropdownButton:
DropdownButton<dynamic>(
value: state.locale.languageCode,
items: [
DropdownMenuItem(
value: 'EN',
child: SizedBox(
child: Text(
'EN',
),
),
),
DropdownMenuItem(
value: 'DE',
child: SizedBox(
child: Text(
'DE',
),
),
),
],
onChanged: (newValue) {
dropdownCallback(newValue, state);
},
underline: DropdownButtonHideUnderline(child: Container()),
),
I have tried to wrap it in sized boxes, both the Button and Menu items, and it doesn’t work. I can’t find any parameters in the documentation to help me with it. Any ideas?
2
Answers
Try to wrap your Dropdown with Container and Set width it hope its help to you
Result->
You can Do like below.