Input widgets and forms
The ability of your app to manage gestures is a good starting point for interaction with the user, but for many apps, you also need a way to get other types of input from a user. Getting user data is what adds custom content and customization to many apps.
Flutter provides many input data widgets to help the developer get different kinds of information from the user. We have already seen some of them in Chapter 5, Widgets – Building Layouts in Flutter, including TextField
, and different kinds of Selector
and Picker
widgets.
A TextField
widget lets the user enter text with a keyboard. The TextField
widget exposes the onChanged
method, which can be used to listen for changes on its current value, as we have seen previously with the TextField
widget. However, another way to listen for changes is by using a controller.
Getting input through a controller
When using a standard TextField
widget, we need to use its controller
property to access its...