I'm trying to set margin/padding top for the list of items that come in dropdown button when clicked. How to set padding for dropdown button.
After clicking dropdown button I get the items on top of the view like this,
I need to get the items below the dropdown button. I tried giving padding inside a container but only the dropdown button seems to be moving and not the items in it. Is there a solution for this?
Code for reference,
ButtonTheme(
alignedDropdown: true,
padding: EdgeInsets.only(left: 0.0, right: 0.0, top: 100, bottom: 0.0),
child:
DropdownButton(
menuMaxHeight: 300.0,
hint: _dropDownValue == null
? Text("---SELECT---", style: TextStyle(color: Colors.black))
:
Text(
_dropDownValue,
style: TextStyle(color: Colors.blue, fontSize: 20),
),
isExpanded: true,
iconSize: 30.0,
icon: Icon(Icons.arrow_drop_down_circle),
iconDisabledColor: Colors.red,
iconEnabledColor: Colors.green,
style: TextStyle(color: Colors.black),
dropdownColor: Colors.white,
items: answer.map(
(val) {
return DropdownMenuItem<String>(
value: val,
child: Text(val),
);
},
).toList(),
onChanged: (val) {
setState(
() {
_dropDownValue = val;
},
);
},
),
),
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
CodePudding user response:
Try below code hope its helpful to you . you must used dropdown_below from