TextField – Widget

The TextField widget is used to accept text input from the user. It supports styling, placeholder text, validation, obscuring text (for passwords), and more.

Source Code​

				
					TextField(
controller: _controller,
  decoration: InputDecoration(
    labelText: 'Username',
    hintText: 'Enter your username',
    border: OutlineInputBorder(),
    prefixIcon: Icon(Icons.person),
  ),
)

				
			

Ai Code Analizer

🎨  Common Properties

PropertyDescription
controllerManages and retrieves the input text
obscureTextHides input (e.g., for passwords)
keyboardTypeSets input type (e.g., TextInputType.emailAddress)
maxLinesAllows multiline input if set > 1
decorationAdds borders, hints, icons via InputDecoration
onChangedCallback for real-time input changes
enabledSet to false to make the field read-only