TxTextFormField constructor
TxTextFormField({
- bool? clearable,
- Key? key,
- FormFieldSetter<
String> ? onSaved, - FormFieldValidator<
String> ? validator, - bool? enabled,
- AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction,
- String? restorationId,
- InputDecoration? decoration,
- ValueChanged<
String?> ? onChanged, - bool? required,
- String? initialValue,
- FocusNode? focusNode,
- String? hintText,
- TextAlign? textAlign,
- bool? bordered,
- TextEditingController? controller,
- UndoHistoryController? undoController,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization? textCapitalization,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextAlignVertical? textAlignVertical,
- TextDirection? textDirection,
- bool? readOnly,
- bool? showCursor,
- bool? autofocus,
- MaterialStatesController? statesController,
- String? obscuringCharacter,
- bool? obscureText,
- bool? autocorrect,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- bool? enableSuggestions,
- int? maxLines,
- int? minLines,
- bool? expands,
- int? maxLength,
- MaxLengthEnforcement? maxLengthEnforcement,
- VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onFieldSubmitted, - AppPrivateCommandCallback? onAppPrivateCommand,
- List<
TextInputFormatter> ? inputFormatters, - double? cursorWidth,
- double? cursorHeight,
- Radius? cursorRadius,
- bool? cursorOpacityAnimates,
- Color? cursorColor,
- Color? cursorErrorColor,
- BoxHeightStyle? selectionHeightStyle,
- BoxWidthStyle? selectionWidthStyle,
- Brightness? keyboardAppearance,
- EdgeInsets? scrollPadding,
- DragStartBehavior? dragStartBehavior,
- bool? enableInteractiveSelection,
- TextSelectionControls? selectionControls,
- ValueChanged<
TxFormFieldState< ? onFieldTap,String> > - GestureTapCallback? onTap,
- bool? onTapAlwaysCalled,
- TapRegionCallback? onTapOutside,
- MouseCursor? mouseCursor,
- InputCounterWidgetBuilder? buildCounter,
- ScrollController? scrollController,
- ScrollPhysics? scrollPhysics,
- Iterable<
String> ? autofillHints, - ContentInsertionConfiguration? contentInsertionConfiguration,
- Clip? clipBehavior,
- bool? scribbleEnabled,
- bool? enableIMEPersonalizedLearning,
- EditableTextContextMenuBuilder? contextMenuBuilder,
- bool? canRequestFocus,
- SpellCheckConfiguration? spellCheckConfiguration,
- TextMagnifierConfiguration? magnifierConfiguration,
- Widget? label,
- String? labelText,
- TextAlign? labelTextAlign,
- TextOverflow? labelOverflow,
- EdgeInsetsGeometry? padding,
- FieldActionsBuilder<
String> ? actionsBuilder, - TextStyle? labelStyle,
- double? horizontalGap,
- Color? tileColor,
- Axis? layoutDirection,
- TxFormFieldBuilder<
String> ? trailingBuilder, - Widget? leading,
- VisualDensity? visualDensity,
- ShapeBorder? shape,
- Color? iconColor,
- Color? textColor,
- TextStyle? leadingAndTrailingTextStyle,
- double? minLeadingWidth,
- double? minLabelWidth,
- double? minVerticalPadding,
- bool? dense,
- bool? colon,
- Color? focusColor,
Implementation
TxTextFormField({
super.clearable,
super.key,
super.onSaved,
FormFieldValidator<String>? validator,
super.enabled,
super.autovalidateMode,
super.restorationId,
super.decoration,
super.onChanged,
super.required,
super.initialValue,
super.focusNode,
String? hintText,
super.textAlign,
super.bordered,
super.controller,
super.undoController,
super.keyboardType,
super.textInputAction,
super.textCapitalization,
super.style,
super.strutStyle,
super.textAlignVertical,
super.textDirection,
super.readOnly,
super.showCursor,
super.autofocus,
super.statesController,
super.obscuringCharacter,
super.obscureText,
super.autocorrect,
super.smartDashesType,
super.smartQuotesType,
super.enableSuggestions,
super.maxLines,
super.minLines,
super.expands,
super.maxLength,
super.maxLengthEnforcement,
super.onEditingComplete,
super.onFieldSubmitted,
super.onAppPrivateCommand,
super.inputFormatters,
super.cursorWidth,
super.cursorHeight,
super.cursorRadius,
super.cursorOpacityAnimates,
super.cursorColor,
super.cursorErrorColor,
super.selectionHeightStyle,
super.selectionWidthStyle,
super.keyboardAppearance,
super.scrollPadding,
super.dragStartBehavior,
super.enableInteractiveSelection,
super.selectionControls,
super.onFieldTap,
super.onTap,
super.onTapAlwaysCalled,
super.onTapOutside,
super.mouseCursor,
super.buildCounter,
super.scrollController,
super.scrollPhysics,
super.autofillHints,
super.contentInsertionConfiguration,
super.clipBehavior,
super.scribbleEnabled,
super.enableIMEPersonalizedLearning,
super.contextMenuBuilder,
super.canRequestFocus,
super.spellCheckConfiguration,
super.magnifierConfiguration,
super.label,
super.labelText,
super.labelTextAlign,
super.labelOverflow,
super.padding,
super.actionsBuilder,
super.labelStyle,
super.horizontalGap,
super.tileColor,
super.layoutDirection,
super.trailingBuilder,
super.leading,
super.visualDensity,
super.shape,
super.iconColor,
super.textColor,
super.leadingAndTrailingTextStyle,
super.minLeadingWidth,
super.minLabelWidth,
super.minVerticalPadding,
super.dense,
super.colon,
super.focusColor,
}) : super(
displayTextMapper: (context, val) => val,
validator: (value) {
if (required == true && (value == null || value.isEmpty)) {
return '请输入';
}
if (validator != null) {
return validator(value);
}
return null;
},
isEmpty: (val) => val.isEmpty,
hintText: readOnly == true ? null : hintText ?? '请输入',
);