TextControl<T>.ofFormField constructor
TextControl<T>.ofFormField (
- SunnyFormFieldState<
T> state, { - Key? key,
- bool obscureText = false,
- OnSubmit<
T> ? onSubmit, - TextInputType? keyboardType,
- Formatter<
T> ? formatter, - TextStyle? style,
- int? minLength,
- List<
ValidatorFn< validators = const [],T> > - bool? isRequired,
- EdgeInsets? padding,
- bool autovalidate = false,
- TextEditingController? controller,
- bool? adaptive,
- bool isLarge = false,
- bool? autocorrect,
- bool? enabled,
- TextInputAction? textInputAction,
- dynamic placeholder,
- Converter<
T?> ? converter, - bool autofocus = false,
- TextCapitalization? textCapitalization,
- TextStyle? placeholderStyle,
- bool expands = false,
- int? minLines,
- int? maxLines,
- Widget? prefix,
- Widget? suffix,
Implementation
TextControl.ofFormField(
SunnyFormFieldState<T> this.state, {
Key? key,
this.obscureText = false,
OnSubmit<T>? onSubmit,
this.keyboardType,
this.formatter,
this.style,
this.minLength,
this.validators = const [],
this.isRequired,
this.padding,
this.autovalidate = false,
this.controller,
this.adaptive,
this.isLarge = false,
this.autocorrect,
bool? enabled,
this.textInputAction,
this.placeholder,
Converter<T?>? converter,
this.autofocus = false,
this.textCapitalization,
this.placeholderStyle,
this.expands = false,
this.minLines,
this.maxLines,
this.prefix,
this.suffix,
}) : enabled = enabled ?? (state.isEnabled != false),
onChange = ((value, source) {
state.updateValue(value, source);
}),
focusNode = state.focusNode,
onSubmitted = ((converted) async {
state.updateValue(converted, AttributeSource.control);
await onSubmit?.call(converted);
}),
onError = ((ValidationError error) {
state.error = error;
}),
converter = converter ?? state.convert,
attribute = state.attribute.cast(),
initialValue = state.value,
super(key: key ?? Key("${state.attribute}-input"));