In mobile apps, collecting input from the user (like name, email, or password) is very important. Flutter makes it easy using widgets like TextField, TextFormField, and input controllers.
TextField(
decoration: InputDecoration(
labelText: 'Enter your name',
border: OutlineInputBorder(),
),
)
TextEditingController myController = TextEditingController();
TextField(
controller: myController,
decoration: InputDecoration(
labelText: 'Enter something',
),
),
ElevatedButton(
onPressed: () {
print(myController.text);
},
child: Text('Submit'),
)
Imagine a notebook where someone writes their name. The TextField is the notebook, and the TextEditingController is like someone who reads what’s written inside and acts on it.
Check more on Flutter's input handling docs.