The GestureDetector widget doesn’t have a visual
representation but instead detects gestures made by the
user. When the user taps the Container,
the GestureDetector calls its onTap() callback, in this
case printing a message to the console. You can use
GestureDetector to detect a variety of input gestures,
including taps, drags, and scales.

Many widgets use a GestureDetector to provide
optional callbacks for other widgets. For example, the
IconButton, ElevatedButton, and
FloatingActionButton widgets have onPressed()
callbacks that are triggered when the user taps the widget.

For more information, see Gestures in Flutter.

Changing widgets in response to input

So far, this page has used only stateless widgets.
Stateless widgets receive arguments from their parent widget,
which they store in final member variables.
When a widget is asked to build(), it uses these stored
values to derive new arguments for the widgets it creates.