'how to add margin in dropdown item menu
how to add margin in dropdown item menu? i want to add space in every menu item
here is my code
// Dropdown Box
Container(
.....
child: DropdownButton(
elevation: 1,
isExpanded: true,
hint: Text(
'--Select One--',
style: TextStyle(
color: Color(0xffB2B2B2),
),
),
items: dropdownOption.map((e) {
return DropdownMenuItem(
value: e['value'],
child: Text(e['label']),
);
}).toList(),
value: dropdownValue,
onChanged: (value) {
setState(() {
dropdownValue = value;
});
},
),
),
if i put padding in text dropdown menu it looks like this
Solution 1:[1]
it turns out it's really simple just add itemHeight in DropdownButton lol
example:
DropdownButton(
itemHeight: 70,
),
Solution 2:[2]
By simply wrapping your text widget with padding widget.
Solution 3:[3]
You can do that with DropdownButton2 by using itemPadding property. DropdownButton2 is based on Flutter's core DropdownButton with steady dropdown menu below the button and many other options you can customize to your needs.
Disclaimer: I am the author of the package mentioned above.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | CCP |
| Solution 2 | Soufiane Saadouni |
| Solution 3 |


