首先,使用TextFormField,它可以使用Controller将数据发送到服务器,但是如果我想使用DropdownBotton方法填写信息,将数据发送到服务器的方式是什么?
final TextEditingController _ctrlCurrent = TextEditingController();
final String current = _ctrlCurrent.text;
Widget _buildCurrent() {
return TextFormField(
controller: _ctrlCurrent,
decoration: InputDecoration(
hintText: '333, 222, 111',
labelText: 'Current',
labelStyle: TextStyle(
color: myFocusNode.hasFocus ? Colors.blue : Colors.black)),
validator: (String value) {
if (value.isEmpty) {
return 'Current is Required';
}
},
onSaved: (String value) {
current = value;
},
);
}