我创建了一个Flutter表单,然后我构建了一个带有颤动的下拉按钮 . 我正在丢失本地儿子数据到下拉列表 . 下拉按钮中的一些项目很长 . 我使用SafeArea和ListView,我正在溢出 .
在另一个问题中没有提到的部分解决方案,我在这里得到答案 .
知道怎么解决吗?
// TODO: BUILD RUN
return new Scaffold(
key: _scaffoldKey,
body: new SafeArea(
top: false,
bottom: false,
child: new Form(
key: _formKey,
child: new ListView(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 32.0),
children: <Widget>[
//TODO: CURRENCY
new FormField<String>(
builder: (FormFieldState<String> state) {
return InputDecorator(
decoration: InputDecoration(
labelText: 'CHOOSE CURRENCY',
labelStyle: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: Colors.green.shade700),
errorText: state.hasError ? state.errorText : null,
),
isEmpty: _mySelectedCurrency == '',
child: new DropdownButtonHideUnderline(
child: new DropdownButton<String>(
style: TextStyle(
fontSize: 14.0,
color: Colors.black,
fontWeight: FontWeight.w500,
),
value: _mySelectedCurrency,
isDense: true,
onChanged: (String newValue) {
setState(() {
_mySelectedCurrency = newValue;
state.didChange(newValue);
});
},
items: _itemsName,
),
),
);
},
validator: (val) {
return val != '' ? null : 'Choose Currency...';
},
),
],
))));
1 回答
虽然我已将问题标记为possible duplicate,但在另一个问题中未提及的部分解决方案是将
isExpanded
属性用于DropDownButton
.