FormeTextField constructor

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

Implementation

FormeTextField({
  super.key,
  super.name,
  super.initialValue = '',
  super.asyncValidator,
  super.asyncValidatorDebounce,
  super.autovalidateMode,
  super.decorator,
  super.enabled = true,
  super.focusNode,
  super.onInitialized,
  super.onSaved,
  super.onStatusChanged,
  super.order,
  super.quietlyValidate = false,
  super.readOnly = false,
  super.requestFocusOnUserInteraction = true,
  super.validationFilter,
  super.validator,
  this.updateValueWhenComposing = false,
  this.selectAllOnFocus = false,
  this.decoration = const InputDecoration(),
  this.maxLines = 1,
  this.keyboardType,
  this.autofocus = false,
  this.minLines,
  this.maxLength,
  this.style,
  this.textInputAction,
  this.textCapitalization = TextCapitalization.none,
  this.obscureText = false,
  this.strutStyle,
  this.textAlign = TextAlign.start,
  this.textAlignVertical,
  this.textDirection,
  this.showCursor,
  this.obscuringCharacter = '•',
  this.autocorrect = true,
  this.smartDashesType,
  this.smartQuotesType,
  this.enableSuggestions = true,
  this.expands = false,
  this.maxLengthEnforcement,
  this.cursorWidth = 2.0,
  this.cursorHeight,
  this.cursorRadius,
  this.cursorColor,
  this.selectionHeightStyle = BoxHeightStyle.tight,
  this.selectionWidthStyle = BoxWidthStyle.tight,
  this.keyboardAppearance,
  this.scrollPadding = const EdgeInsets.all(20),
  this.dragStartBehavior = DragStartBehavior.start,
  this.mouseCursor,
  this.scrollPhysics,
  this.autofillHints,
  this.enableInteractiveSelection = true,
  this.onEditingComplete,
  this.inputFormatters,
  this.appPrivateCommandCallback,
  this.buildCounter,
  this.onTap,
  this.onSubmitted,
  this.scrollController,
  this.textSelectionControls,
  this.enableIMEPersonalizedLearning = true,
  this.onTapOutside,
  this.clipBehavior,
  this.scribbleEnabled,
  this.contextMenuBuilder = _defaultContextMenuBuilder,
  this.spellCheckConfiguration,
  this.magnifierConfiguration,
}) : super.allFields(
        builder: (baseState) {
          final bool readOnly = baseState.readOnly;
          final bool enabled = baseState.enabled;
          final FormeTextFieldState state = baseState as FormeTextFieldState;
          return TextField(
            onTapOutside: onTapOutside,
            clipBehavior: clipBehavior ?? Clip.hardEdge,
            scribbleEnabled: scribbleEnabled ?? true,
            contextMenuBuilder: contextMenuBuilder,
            spellCheckConfiguration: spellCheckConfiguration,
            magnifierConfiguration: magnifierConfiguration ??
                TextMagnifier.adaptiveMagnifierConfiguration,
            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,
            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,
            enableInteractiveSelection: enableInteractiveSelection,
            buildCounter: buildCounter,
            maxLengthEnforcement: updateValueWhenComposing
                ? maxLengthEnforcement
                : MaxLengthEnforcement.truncateAfterCompositionEnds,
            inputFormatters: inputFormatters,
            keyboardType: keyboardType,
            maxLength: maxLength,
            scrollController: scrollController,
            selectionControls: textSelectionControls,
          );
        },
      );