TextInput class

A text input widget with cursor support.

controller, value, placeholder, and onChanged always hold the user's RAW text — the obscureText flag only affects what is painted to the buffer.

Inheritance

Constructors

TextInput({TextEditingController? controller, String? value, String? placeholder, Color? color, Color? backgroundColor, Color? cursorColor, CursorStyle cursorStyle = CursorStyle.block, bool obscureText = false, String obscuringCharacter = '*', int maxLength = 100, ValueChanged<String>? onChanged, VoidCallback? onSubmit, FocusNode? focusNode, bool autofocus = false, Key? key})
Configures a single-line editor; controller and value are exclusive.
const

Properties

autofocus bool
Whether the field requests focus when first mounted. Defaults to false.
final
backgroundColor Color?
Fill color painted behind the field. Falls back to ThemeData.surface under a Theme; with neither, the field paints no fill. Pass Color.transparent for an explicitly unfilled field inside a themed subtree.
final
color Color?
Foreground color of the text. Falls back to ThemeData.text.
final
controller TextEditingController?
The controller that owns this field's text and selection.
final
cursorColor Color?
Color of the cursor. Falls back to ThemeData.cursor.
final
cursorStyle CursorStyle
Shape drawn for the cursor. Defaults to CursorStyle.block.
final
focusNode FocusNode?
Focus node controlling this field's focus. One is created if null.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how this widget replaces another of the same type.
finalinherited
maxLength int
Maximum number of characters accepted. Defaults to 100.
final
obscureText bool
When true, paint each grapheme of value as obscuringCharacter without modifying the stored text. onChanged still receives the raw user input.
final
obscuringCharacter String
Single grapheme cluster used to replace each visible cluster when obscureText is true. Defaults to '*'.
final
onChanged ValueChanged<String>?
Called whenever the text value changes.
final
onSubmit VoidCallback?
Called when the user submits the current text value.
final
placeholder String?
Dimmed hint text shown when the field is empty.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String?
Initial/current value when controller is not supplied.
final

Methods

createState() State<TextInput>
Creates the mutable State for this widget.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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