[英]A RenderFlex overflowed by 93 pixels on the bottom
Form(
key: _formKey,
child: Container(
alignment: Alignment.center,
height: 55,
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black,width: 2)
),
child: DropdownButtonHideUnderline(
child: DropDownField(
value: value,
enabled: true,
items: locationItem,
itemsVisibleInDropdown: 2,
onValueChanged: (value) {
setState(() {
this.value = value!;
locationId = value;
print(value);
print(locationId);
});
},
),
),
),
)
我已經嘗試過 Singlechildscrollerview 也有關於這個的任何答案:
試試下面的代碼希望它對你有幫助。 請在此處參考 DropdownButton 類
變量聲明:
String dropdownValue = 'One';
你的小工具:
Container(
alignment: Alignment.center,
height: 55,
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black, width: 2)),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: dropdownValue,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: <String>['One', 'Two', 'Free', 'Four']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.