FormeTextField constructor
FormeTextField({
- Key? key,
- String? name,
- String initialValue = '',
- FormeAsyncValidator<
String> ? asyncValidator, - Duration? asyncValidatorDebounce,
- AutovalidateMode? autovalidateMode,
- FormeFieldDecorator<
String> ? decorator, - bool enabled = true,
- FocusNode? focusNode,
- FormeFieldInitialized<
String> ? onInitialized, - FormeFieldSetter<
String> ? onSaved, - FormeFieldStatusChanged<
String> ? onStatusChanged, - int? order,
- bool quietlyValidate = false,
- bool readOnly = false,
- bool requestFocusOnUserInteraction = true,
- FormeFieldValidationFilter<
String> ? validationFilter, - FormeValidator<
String> ? validator, - bool updateValueWhenComposing = false,
- bool selectAllOnFocus = false,
- InputDecoration? decoration = const InputDecoration(),
- int? maxLines = 1,
- TextInputType? keyboardType,
- bool autofocus = false,
- int? minLines,
- int? maxLength,
- TextStyle? style,
- 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,
- VoidCallback? onEditingComplete,
- List<
TextInputFormatter> ? inputFormatters, - AppPrivateCommandCallback? appPrivateCommandCallback,
- InputCounterWidgetBuilder? buildCounter,
- GestureTapCallback? onTap,
- ValueChanged<
String> ? onSubmitted, - ScrollController? scrollController,
- TextSelectionControls? textSelectionControls,
- bool enableIMEPersonalizedLearning = true,
- TapRegionCallback? onTapOutside,
- Clip? clipBehavior,
- bool? scribbleEnabled,
- EditableTextContextMenuBuilder? contextMenuBuilder = _defaultContextMenuBuilder,
- SpellCheckConfiguration? spellCheckConfiguration,
- 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,
);
},
);