TextField class

A single-line or multi-line text input field.

Supports keyboard navigation, text selection, clipboard operations, and configurable maxLength. Use TextEditingController for programmatic access to the text and selection state.

Inheritance

Constructors

TextField({Key? key, TextEditingController? controller, String? placeholder, TextStyle? style, int? maxLength, dynamic onChanged(String)?, dynamic onSubmitted(String)?})
Creates a TextField with optional controller, placeholder, and callbacks.
const

Properties

controller TextEditingController?
An optional external controller for the text content and selection.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another in the tree.
finalinherited
maxLength int?
The maximum number of characters allowed.
final
onChanged → dynamic Function(String)?
Called whenever the text content changes.
final
onSubmitted → dynamic Function(String)?
Called when the user presses Enter.
final
placeholder String?
Placeholder text displayed when the field is empty.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style TextStyle?
The text style applied to the input text.
final

Methods

createElement() StatefulElement
Creates the Element for this widget.
inherited
createState() State<TextField>
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