TextInputStatefulWidget constructor
const
TextInputStatefulWidget({
- Key? key,
- Object groupId = EditableText,
- TextEditingController? controller,
- FocusNode? focusNode,
- BoxDecoration? decoration,
- EdgeInsetsGeometry? padding,
- Widget? placeholder,
- CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
- String? clearButtonSemanticLabel,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextAlign textAlign = TextAlign.start,
- TextAlignVertical? textAlignVertical,
- TextDirection? textDirection,
- bool readOnly = false,
- bool? showCursor,
- bool autofocus = false,
- String obscuringCharacter = '•',
- bool obscureText = false,
- bool autocorrect = true,
- SmartDashesType smartDashesType = SmartDashesType.enabled,
- SmartQuotesType smartQuotesType = SmartQuotesType.enabled,
- bool enableSuggestions = true,
- int? maxLines = 1,
- int? minLines,
- bool expands = false,
- int? maxLength,
- MaxLengthEnforcement? maxLengthEnforcement,
- ValueChanged<
String> ? onChanged, - VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onSubmitted, - TapRegionCallback? onTapOutside,
- TapRegionCallback? onTapUpOutside,
- List<
TextInputFormatter> ? inputFormatters, - bool enabled = true,
- double cursorWidth = 2.0,
- double? cursorHeight,
- Radius cursorRadius = const Radius.circular(2.0),
- bool cursorOpacityAnimates = true,
- Color? cursorColor,
- BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
- BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
- Brightness? keyboardAppearance,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- bool enableInteractiveSelection = true,
- TextSelectionControls? selectionControls,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollController? scrollController,
- ScrollPhysics? scrollPhysics,
- GestureTapCallback? onTap,
- Iterable<
String> ? autofillHints = const [], - Clip clipBehavior = Clip.hardEdge,
- String? restorationId,
- bool stylusHandwritingEnabled = EditableText.defaultStylusHandwritingEnabled,
- bool enableIMEPersonalizedLearning = true,
- ContentInsertionConfiguration? contentInsertionConfiguration,
- EditableTextContextMenuBuilder? contextMenuBuilder,
- String? initialValue,
- String? hintText,
- Border? border,
- BorderRadiusGeometry? borderRadius,
- bool? filled,
- WidgetStatesController? statesController,
- TextMagnifierConfiguration? magnifierConfiguration,
- SpellCheckConfiguration? spellCheckConfiguration,
- UndoHistoryController? undoController,
- List<
InputFeature> features = const [], - List<
TextInputFormatter> ? submitFormatters = const [], - bool skipInputFeatureFocusTraversal = false,
Creates a stateful text input widget with comprehensive configuration options.
This constructor accepts all properties defined in the TextInput mixin, providing extensive control over text input behavior, appearance, and interactions.
Most parameters mirror Flutter's EditableText widget while adding custom features like input features, decorations, and form integration.
Key parameters include:
controller: Text editing controller, created automatically if nullfocusNode: Focus node for keyboard interactiondecoration: Box decoration for the input containerpadding: Inner padding around the text fieldplaceholder: Widget shown when field is emptyenabled: Whether input accepts user interaction, defaults to truereadOnly: Whether text can be edited, defaults to falseobscureText: Whether to hide input (for passwords), defaults to falsemaxLines: Maximum number of lines, defaults to 1features: List of input features (e.g., clear button, character count)
See TextInput mixin documentation for full parameter details.
Implementation
const TextInputStatefulWidget({
super.key,
this.groupId = EditableText,
this.controller,
this.focusNode,
this.decoration,
this.padding,
this.placeholder,
this.crossAxisAlignment = CrossAxisAlignment.center,
this.clearButtonSemanticLabel,
this.keyboardType,
this.textInputAction,
this.textCapitalization = TextCapitalization.none,
this.style,
this.strutStyle,
this.textAlign = TextAlign.start,
this.textAlignVertical,
this.textDirection,
this.readOnly = false,
this.showCursor,
this.autofocus = false,
this.obscuringCharacter = '•',
this.obscureText = false,
this.autocorrect = true,
this.smartDashesType = SmartDashesType.enabled,
this.smartQuotesType = SmartQuotesType.enabled,
this.enableSuggestions = true,
this.maxLines = 1,
this.minLines,
this.expands = false,
this.maxLength,
this.maxLengthEnforcement,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.onTapOutside,
this.onTapUpOutside,
this.inputFormatters,
this.enabled = true,
this.cursorWidth = 2.0,
this.cursorHeight,
this.cursorRadius = const Radius.circular(2.0),
this.cursorOpacityAnimates = true,
this.cursorColor,
this.selectionHeightStyle = ui.BoxHeightStyle.tight,
this.selectionWidthStyle = ui.BoxWidthStyle.tight,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.enableInteractiveSelection = true,
this.selectionControls,
this.dragStartBehavior = DragStartBehavior.start,
this.scrollController,
this.scrollPhysics,
this.onTap,
this.autofillHints = const [],
this.clipBehavior = Clip.hardEdge,
this.restorationId,
this.stylusHandwritingEnabled =
EditableText.defaultStylusHandwritingEnabled,
this.enableIMEPersonalizedLearning = true,
this.contentInsertionConfiguration,
this.contextMenuBuilder,
this.initialValue,
this.hintText,
this.border,
this.borderRadius,
this.filled,
this.statesController,
this.magnifierConfiguration,
this.spellCheckConfiguration,
this.undoController,
this.features = const [],
this.submitFormatters = const [],
this.skipInputFeatureFocusTraversal = false,
});