Expanded(
child: new DropdownButtonFormField(
value: widget._type,
style: TextStyle(color: Colors.red),
icon: Icon(Icons.sort),
items:
<String>['字符串', '数字'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (val) {
setState(() {
widget._type = val;
});
},
)),
flutter .map用法示例
最新推荐文章于 2024-06-20 09:40:16 发布