FormeTextField constructor

FormeTextField({
  1. String? initialValue,
  2. required String name,
  3. bool readOnly = false,
  4. Key? key,
  5. InputDecoration? decoration,
  6. int? maxLines = 1,
  7. int? order,
  8. bool quietlyValidate = false,
  9. bool selectAllOnFocus = false,
  10. TextInputType? keyboardType,
  11. bool autofocus = false,
  12. int? minLines,
  13. int? maxLength,
  14. TextStyle? style,
  15. ToolbarOptions? toolbarOptions,
  16. TextInputAction? textInputAction,
  17. TextCapitalization textCapitalization = TextCapitalization.none,
  18. bool obscureText = false,
  19. StrutStyle? strutStyle,
  20. TextAlign textAlign = TextAlign.start,
  21. TextAlignVertical? textAlignVertical,
  22. TextDirection? textDirection,
  23. bool? showCursor,
  24. String obscuringCharacter = '•',
  25. bool autocorrect = true,
  26. SmartDashesType? smartDashesType,
  27. SmartQuotesType? smartQuotesType,
  28. bool enableSuggestions = true,
  29. bool expands = false,
  30. MaxLengthEnforcement? maxLengthEnforcement,
  31. double cursorWidth = 2.0,
  32. double? cursorHeight,
  33. Radius? cursorRadius,
  34. Color? cursorColor,
  35. BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  36. BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  37. Brightness? keyboardAppearance,
  38. EdgeInsets scrollPadding = const EdgeInsets.all(20),
  39. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  40. MouseCursor? mouseCursor,
  41. ScrollPhysics? scrollPhysics,
  42. Iterable<String>? autofillHints,
  43. bool enableInteractiveSelection = true,
  44. bool enabled = true,
  45. VoidCallback? onEditingComplete,
  46. List<TextInputFormatter>? inputFormatters,
  47. AppPrivateCommandCallback? appPrivateCommandCallback,
  48. InputCounterWidgetBuilder? buildCounter,
  49. GestureTapCallback? onTap,
  50. ValueChanged<String>? onSubmitted,
  51. ScrollController? scrollController,
  52. TextSelectionControls? textSelectionControls,
  53. Duration? asyncValidatorDebounce,
  54. AutovalidateMode? autovalidateMode,
  55. FormeValueChanged<String>? onValueChanged,
  56. FormeFocusChanged<String>? onFocusChanged,
  57. FormeFieldValidationChanged<String>? onValidationChanged,
  58. FormeFieldInitialed<String>? onInitialed,
  59. FormeFieldSetter<String>? onSaved,
  60. FormeValidator<String>? validator,
  61. FormeAsyncValidator<String>? asyncValidator,
  62. bool enableIMEPersonalizedLearning = true,
  63. FormeFieldDecorator<String>? decorator,
  64. bool registrable = true,
  65. bool updateValueWhenComposing = false,
})

Implementation

FormeTextField({
  String? initialValue,
  required String name,
  bool readOnly = false,
  Key? key,
  InputDecoration? decoration,
  int? maxLines = 1,
  int? order,
  bool quietlyValidate = false,
  this.selectAllOnFocus = false,
  TextInputType? keyboardType,
  bool autofocus = false,
  int? minLines,
  int? maxLength,
  TextStyle? style,
  ToolbarOptions? toolbarOptions,
  TextInputAction? textInputAction,
  TextCapitalization textCapitalization = TextCapitalization.none,
  bool obscureText = false,
  StrutStyle? strutStyle,
  TextAlign textAlign = TextAlign.start,
  TextAlignVertical? textAlignVertical,
  TextDirection? textDirection,
  bool? showCursor,
  String obscuringCharacter = '•',
  bool autocorrect = true,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  bool enableSuggestions = true,
  bool expands = false,
  MaxLengthEnforcement? maxLengthEnforcement,
  double cursorWidth = 2.0,
  double? cursorHeight,
  Radius? cursorRadius,
  Color? cursorColor,
  BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  Brightness? keyboardAppearance,
  EdgeInsets scrollPadding = const EdgeInsets.all(20),
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  MouseCursor? mouseCursor,
  ScrollPhysics? scrollPhysics,
  Iterable<String>? autofillHints,
  bool enableInteractiveSelection = true,
  bool enabled = true,
  VoidCallback? onEditingComplete,
  List<TextInputFormatter>? inputFormatters,
  AppPrivateCommandCallback? appPrivateCommandCallback,
  InputCounterWidgetBuilder? buildCounter,
  GestureTapCallback? onTap,
  ValueChanged<String>? onSubmitted,
  ScrollController? scrollController,
  TextSelectionControls? textSelectionControls,
  Duration? asyncValidatorDebounce,
  AutovalidateMode? autovalidateMode,
  FormeValueChanged<String>? onValueChanged,
  FormeFocusChanged<String>? onFocusChanged,
  FormeFieldValidationChanged<String>? onValidationChanged,
  FormeFieldInitialed<String>? onInitialed,
  FormeFieldSetter<String>? onSaved,
  FormeValidator<String>? validator,
  FormeAsyncValidator<String>? asyncValidator,
  bool enableIMEPersonalizedLearning = true,
  FormeFieldDecorator<String>? decorator,
  bool registrable = true,
  this.updateValueWhenComposing = false,
}) : super(
        enabled: enabled,
        registrable: registrable,
        decorator: decorator,
        order: order,
        quietlyValidate: quietlyValidate,
        asyncValidatorDebounce: asyncValidatorDebounce,
        autovalidateMode: autovalidateMode,
        onValueChanged: onValueChanged,
        onFocusChanged: onFocusChanged,
        onValidationChanged: onValidationChanged,
        onInitialed: onInitialed,
        onSaved: onSaved,
        validator: validator,
        asyncValidator: asyncValidator,
        key: key,
        name: name,
        readOnly: readOnly,
        initialValue: initialValue ?? '',
        builder: (baseState) {
          final bool readOnly = baseState.readOnly;
          final bool enabled = baseState.enabled;
          final _FormeTextFieldState state =
              baseState as _FormeTextFieldState;

          return TextField(
            enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
            focusNode: state.focusNode,
            controller: state.textEditingController,
            decoration: decoration?.copyWith(errorText: state.errorText),
            obscureText: obscureText,
            maxLines: maxLines,
            minLines: minLines,
            enabled: enabled,
            readOnly: readOnly,
            onTap: onTap,
            onEditingComplete: onEditingComplete,
            onSubmitted: onSubmitted,
            // onChanged: state._didChange,
            onAppPrivateCommand: appPrivateCommandCallback,
            textInputAction: textInputAction,
            textCapitalization: textCapitalization,
            style: style,
            strutStyle: strutStyle,
            textAlign: textAlign,
            textAlignVertical: textAlignVertical,
            textDirection: textDirection,
            showCursor: showCursor,
            obscuringCharacter: obscuringCharacter,
            autocorrect: autocorrect,
            smartDashesType: smartDashesType,
            smartQuotesType: smartQuotesType,
            enableSuggestions: enableSuggestions,
            expands: expands,
            cursorWidth: cursorWidth,
            cursorHeight: cursorHeight,
            cursorRadius: cursorRadius,
            cursorColor: cursorColor,
            selectionHeightStyle: selectionHeightStyle,
            selectionWidthStyle: selectionWidthStyle,
            keyboardAppearance: keyboardAppearance,
            scrollPadding: scrollPadding,
            dragStartBehavior: dragStartBehavior,
            mouseCursor: mouseCursor,
            scrollPhysics: scrollPhysics,
            autofillHints: readOnly ? null : autofillHints,
            autofocus: autofocus,
            toolbarOptions: toolbarOptions,
            enableInteractiveSelection: enableInteractiveSelection,
            buildCounter: buildCounter,
            maxLengthEnforcement: updateValueWhenComposing
                ? maxLengthEnforcement
                : MaxLengthEnforcement.truncateAfterCompositionEnds,
            inputFormatters: inputFormatters,
            keyboardType: keyboardType,
            maxLength: maxLength,
            scrollController: scrollController,
            selectionControls: textSelectionControls,
          );
        },
      );