我正在嘗試為單擊時出現在下拉按鈕中的專案串列設定邊距/填充頂部。如何設定下拉按鈕的填充。

單擊下拉按鈕后,我會像這樣將專案放在視圖頂部,

我需要獲取下拉按鈕下方的專案。我嘗試在容器內提供填充,但似乎只有下拉按鈕在移動,而不是其中的專案。有解決方案嗎?
代碼參考,
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;
},
);
},
),
),
uj5u.com熱心網友回復:
試試下面的代碼希望它對你有幫助。你必須從
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/340061.html
