TextControl<T>.ofFormField constructor

TextControl<T>.ofFormField(
  1. SunnyFormFieldState<T> state, {
  2. Key? key,
  3. bool obscureText = false,
  4. OnSubmit<T>? onSubmit,
  5. TextInputType? keyboardType,
  6. Formatter<T>? formatter,
  7. TextStyle? style,
  8. int? minLength,
  9. List<ValidatorFn<T>> validators = const [],
  10. bool? isRequired,
  11. EdgeInsets? padding,
  12. bool autovalidate = false,
  13. TextEditingController? controller,
  14. bool? adaptive,
  15. bool isLarge = false,
  16. bool? autocorrect,
  17. bool? enabled,
  18. TextInputAction? textInputAction,
  19. dynamic placeholder,
  20. Converter<T?>? converter,
  21. bool autofocus = false,
  22. TextCapitalization? textCapitalization,
  23. TextStyle? placeholderStyle,
  24. bool expands = false,
  25. int? minLines,
  26. int? maxLines,
  27. Widget? prefix,
  28. 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"));