TextInput class

A comprehensive text entry field component for the Alter Design System built on InputControl.

Direct implementation of Figma Node 471:1547 (TextInput):

  • Composes InputControl with Figma default configuration:
    • leftIcon: Icons.face_5_outlined
    • rightButton: null (interactive trailing action via ButtonIconGhost)
    • prefix: null
    • suffix: null
    • label: 'Label'
    • characterLimit: 32
  • Full Flutter FormField<String> integration supporting Form.validate() and Form.save().
  • Supports multiple simultaneous error conditions, rendering the latest error in evaluation order.
  • Built-in validation for required (deferred until touch/blur or Form submit), email, phone, and character limits.
Inheritance

Constructors

TextInput({Key? key, String? label = 'Label', int? characterLimit = 32, InputControlType type = InputControlType.gray, IconData? leftIcon = Icons.face_5_outlined, Widget? leftIconWidget, String? prefix, Widget? prefixWidget, String placeholder = 'Input', String? value, TextEditingController? controller, FocusNode? focusNode, String? suffix, Widget? suffixWidget, ButtonIconGhost? rightButton, int? maxLines = 1, int? minLines = 1, List<TextInputFormatter>? inputFormatters, TextInputMode inputMode = TextInputMode.all, TextInputType? keyboardType, bool? autocorrect, bool? enableSuggestions, Iterable<String>? autofillHints, bool isRequired = false, bool autoValidateRules = true, bool isError = false, bool showErrorMessage = true, String errorMessage = 'Error Message', List<String>? errorMessages, String? requiredErrorText, String? emailErrorText, String? phoneErrorText, String? characterLimitErrorText, Widget? errorIconWidget, bool enabled = true, bool readOnly = false, bool autofocus = false, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, VoidCallback? onEditingComplete, VoidCallback? onTap, TextInputAction textInputAction = TextInputAction.done, FormFieldValidator<String>? validator, FormFieldSetter<String>? onSaved, AutovalidateMode? autovalidateMode})
Creates a TextInput instance.
const

Properties

autocorrect → bool?
Whether autocorrection is enabled.
final
autofillHints → Iterable<String>?
Autofill hints for autofill services.
final
autofocus → bool
Whether the input field autofocuses.
final
autovalidateMode → AutovalidateMode?
Autovalidate mode for form integration.
final
autoValidateRules → bool
Whether built-in validation rules (email, phone, required) run automatically.
final
characterLimit → int?
Maximum allowed character limit counter displayed on typing.
final
characterLimitErrorText → String?
Custom error text when character limit is exceeded.
final
controller → TextEditingController?
External text editing controller.
final
emailErrorText → String?
Custom error text for invalid email formats.
final
enabled → bool
Whether the input field is interactive.
final
enableSuggestions → bool?
Whether input suggestions are enabled.
final
errorIconWidget → Widget?
Custom icon widget override for the error message banner.
final
errorMessage → String
Default error message text.
final
errorMessages → List<String>?
Optional list of multiple error messages.
final
focusNode → FocusNode?
Focus node controlling input focus.
final
hashCode → int
The hash code for this object.
no setterinherited
inputFormatters → List<TextInputFormatter>?
Formatters applied to the text field input.
final
inputMode → TextInputMode
Preset filtering and keyboard mode (e.g. email, phone, alphanumeric).
final
isError → bool
Whether the input is in an explicit error state.
final
isRequired → bool
Whether to enforce required field validation and show red asterisk.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType → TextInputType?
Virtual keyboard type for software keyboards.
final
label → String?
Label text displayed above the input field.
final
leftIcon → IconData?
Leading icon data.
final
leftIconWidget → Widget?
Custom leading widget override.
final
maxLines → int?
Maximum number of lines for multiline input.
final
minLines → int?
Minimum number of lines for multiline input.
final
onChanged → ValueChanged<String>?
Callback executed on value changes.
final
onEditingComplete → VoidCallback?
Callback executed when editing is completed.
final
onSaved → FormFieldSetter<String>?
Form field on-saved callback.
final
onSubmitted → ValueChanged<String>?
Callback executed on keyboard submit.
final
onTap → VoidCallback?
Callback executed when the input container is tapped.
final
phoneErrorText → String?
Custom error text for invalid phone formats.
final
placeholder → String
Hint placeholder text.
final
prefix → String?
Prefix text displayed before the input value.
final
prefixWidget → Widget?
Custom prefix widget override.
final
readOnly → bool
Whether the field is read-only.
final
requiredErrorText → String?
Custom error text when a required field is left empty.
final
rightButton → ButtonIconGhost?
Trailing action button (e.g. ButtonIconGhost).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showErrorMessage → bool
Whether to render the error message beneath the field.
final
suffix → String?
Suffix descriptor text displayed at the trailing end.
final
suffixWidget → Widget?
Custom suffix widget override.
final
textInputAction → TextInputAction
Keyboard action button (e.g. done, search).
final
type → InputControlType
Surface background and border style variant.
final
validator → FormFieldValidator<String>?
Form field validation callback.
final
value → String?
Initial or bound value string.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<TextInput>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

version → const String
Component version for reference. v2.3.0: Streamlined multiline sizing: Clean minLines and maxLines configuration without redundant boolean flags. v2.2.0: Fixed isRequired trigger lifecycle: Defer required error until blur (unfocus after focus) or explicit typing & clearing, preventing immediate error upon clicking into an empty field. v2.1.0: Aligned with InputControl v2.1.0: removed showLabel and showCharacterLimit booleans. Label bar and UI counter render when label is non-null. v2.0.0: Pure Flutter convention overhaul: Removed statusOverride and redundant hasLabel, hasCharacterLimit, hasPrefix, hasSuffix, and hasLeftIcon flags in favor of clean nullable properties. v1.6.0: Streamlined right action slot to accept ButtonIconGhost? rightButton directly (matching InputControl v1.6.0). v1.5.0: Integrated ButtonIconGhost rightIcon configuration (rightIconType, onRightIconTap), maxLines/minLines, and inputFormatters passthrough to InputControl v1.5.0. v1.4.0: Deferred isRequired validation until touch/blur or explicit Form validation (preventing immediate errors on pristine load). v1.3.0: Added support for multiple error conditions rendering the latest error in order; integrated InputControl v1.4.0 isRequired asterisk styling. v1.2.0: Aligned character limit overflow behavior with InputControl v1.3.0 ('Character limit exceeded'). v1.1.0: Updated to use InputControl v1.2.0 API: renamed wordLimit to characterLimit, hide labelBar if showLabel is false, dynamic characterLimit shown only in typing state, independent isError and showErrorMessage properties. v2.4.0: Added optional keyboardType (TextInputType?) fallback for direct native virtual keyboard override. v2.3.0: Multiline sizing support: Added minLines and maxLines passthrough with safe bounds guarding. v2.2.0: Added TextInputMode enum (all, numeric, email, phone, decimal, alphanumeric, onlyAlphabets, onlyNumbers) with automatic formatters, autocorrect, autofillHints, enableSuggestions, and phone/email validation. v2.1.0: Aligned with InputControl v2.1.0 (removed showLabel/showCharacterLimit; labelBar renders when label is provided). v2.0.0: Aligned with InputControl v2.0.0 (removed statusOverride and redundant hasX booleans in favor of clean nullable props). v1.0.0: Initial release of TextInput built on InputControl.