field method
Implementation
field(FocusNode fn, TextEditingController textEditingController) => TextFormField(
focusNode: fn,
textAlign: _textAlign,
maxLength: _maxLen,
controller: textEditingController,
onChanged: (newValue) async {
if (useOptionsList) {
var opt = await allOptions(newValue);
var item = opt.firstWhereOrNull((e) => valueSelector(e) == newValue);
onChanged(item, newValue);
} else {
onChanged(newValue.changeTo<T>(), newValue);
}
},
onEditingComplete: widget.onEditingComplete,
onFieldSubmitted: widget.onFieldSubmitted,
inputFormatters: _inputFormatters,
keyboardType: _keyboardType,
decoration: outlineInputStyle(context, widget.label, widget.icon, widget.onIconTap, widget.color, widget.suffixIcon, widget.onSuffixIconTap, widget.decoration),
validator: (s) {
if (widget.validator != null) {
try {
return widget.validator!(changeTo<T>(s));
} catch (e) {
return "$e";
}
}
return null;
},
maxLines: widget.lines,
readOnly: widget.readOnly,
obscureText: widget.obscureText,
textInputAction: widget.textInputAction,
);