【发布时间】:2019-04-12 06:18:42
【问题描述】:
我创建了一个 Flutter 表单,并使用 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...';
},
),
],
))));
【问题讨论】:
-
是的,类似...而且似乎 GitHub 问题尚未解决。问题是解决方法不会为我解决,下拉菜单项有时会超过 3 行...寻找固定和封闭的解决方案,谢谢
标签: dart flutter overflow dropdown