TextField constructor
const
TextField({
- Key? key,
- Object? groupId,
- String? label,
- Widget? labelWidget,
- bool appendColonToLabel = true,
- TextStyle? labelStyle,
- String? hintText,
- FocusNode? focusNode,
- UndoHistoryController? undoController,
- String? errorText,
- bool enabled = true,
- bool readOnly = false,
- Widget? suffix,
- Widget? suffixIcon,
- Widget? prefix,
- Widget? prefixIcon,
- bool obscureText = false,
- String obscuringCharacter = '•',
- bool? filled,
- Color? fillColor,
- BorderRadius? borderRadius,
- TextEditingController? controller,
- List<
InputFeedbackText> ? feedback, - TextInputType? keyboardType,
- List<
TextInputFormatter> ? inputFormatters, - TextCapitalization textCapitalization = material.TextCapitalization.none,
- TextAlign textAlign = material.TextAlign.start,
- TextInputAction? textInputAction,
- StrutStyle? strutStyle,
- TextDirection? textDirection,
- int? maxLength,
- MaxLengthEnforcement? maxLengthEnforcement,
- int? maxLines = 1,
- int? minLines,
- bool? expands,
- TextStyle? textStyle,
- ValueChanged<
String> ? onChanged, - VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onSubmitted, - AppPrivateCommandCallback? onAppPrivateCommand,
- InputDecoration? decoration,
- bool overrideDecoration = false,
- TextAlignVertical? textAlignVertical,
- WrapWidgetBuilder? innerBoxWrapper,
- EdgeInsets scrollPadding = const EdgeInsets.all(10),
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- bool? autocorrect,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- double? cursorHeight,
- bool forceErrorStyle = false,
- bool? showCursor,
- Iterable<
String> ? autofillHints = const [], - GestureTapCallback? onTap,
- bool onTapAlwaysCalled = false,
- TapRegionCallback? onTapOutside,
- TapRegionUpCallback? onTapUpOutside,
- bool autofocus = false,
- bool canRequestFocus = true,
- bool enableSuggestions = true,
- bool enableInteractiveSelection = true,
- TextSelectionControls? selectionControls,
- BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
- BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
- Brightness? keyboardAppearance,
- InputCounterWidgetBuilder? buildCounter,
- EditableTextContextMenuBuilder? contextMenuBuilder,
- Clip clipBehavior = material.Clip.hardEdge,
- Color? cursorColor,
- Color? cursorErrorColor,
- double cursorWidth = 2.0,
- Radius? cursorRadius,
- bool cursorOpacityAnimates = true,
- MouseCursor? mouseCursor,
- ScrollController? scrollController,
- ScrollPhysics? scrollPhysics,
- ContentInsertionConfiguration? contentInsertionConfiguration,
- String? restorationId,
- bool scribbleEnabled = true,
- bool? stylusHandwritingEnabled,
- bool enableIMEPersonalizedLearning = true,
- SpellCheckConfiguration? spellCheckConfiguration,
- TextMagnifierConfiguration? magnifierConfiguration,
- WidgetStatesController? statesController,
- bool? ignorePointers,
Implementation
const TextField({
Key? key,
this.groupId,
this.label,
this.labelWidget,
this.appendColonToLabel = true,
this.labelStyle,
this.hintText,
this.focusNode,
this.undoController,
this.errorText,
this.enabled = true,
this.readOnly = false,
this.suffix,
this.suffixIcon,
this.prefix,
this.prefixIcon,
this.obscureText = false,
this.obscuringCharacter = '•',
this.filled,
this.fillColor,
this.borderRadius,
this.controller,
this.feedback,
this.keyboardType,
this.inputFormatters,
this.textCapitalization = material.TextCapitalization.none,
this.textAlign = material.TextAlign.start,
this.textInputAction,
this.strutStyle,
this.textDirection,
this.maxLength,
this.maxLengthEnforcement,
this.maxLines = 1,
this.minLines,
this.expands,
this.textStyle,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.onAppPrivateCommand,
this.decoration,
this.overrideDecoration = false,
this.textAlignVertical,
this.innerBoxWrapper,
this.scrollPadding = const EdgeInsets.all(10),
this.dragStartBehavior = DragStartBehavior.start,
this.autocorrect,
this.smartDashesType,
this.smartQuotesType,
this.cursorHeight,
this.forceErrorStyle = false,
this.showCursor,
this.autofillHints = const [],
this.onTap,
this.onTapAlwaysCalled = false,
this.onTapOutside,
this.onTapUpOutside,
this.autofocus = false,
this.canRequestFocus = true,
this.enableSuggestions = true,
this.enableInteractiveSelection = true,
this.selectionControls,
this.selectionHeightStyle = ui.BoxHeightStyle.tight,
this.selectionWidthStyle = ui.BoxWidthStyle.tight,
this.keyboardAppearance,
this.buildCounter,
this.contextMenuBuilder,
this.clipBehavior = material.Clip.hardEdge,
this.cursorColor,
this.cursorErrorColor,
this.cursorWidth = 2.0,
this.cursorRadius,
this.cursorOpacityAnimates = true,
this.mouseCursor,
this.scrollController,
this.scrollPhysics,
this.contentInsertionConfiguration,
this.restorationId,
this.scribbleEnabled = true,
this.stylusHandwritingEnabled,
this.enableIMEPersonalizedLearning = true,
this.spellCheckConfiguration,
this.magnifierConfiguration,
this.statesController,
this.ignorePointers,
}) : assert(
label == null || labelWidget == null,
'You cannot provide both `label` and `labelWidget` at the same time. '
'Use only one of them.',
),
super(key: key);