A mix-and-match approach

How do you decide which approach to use?
The following principles should help you decide:

If the state in question is user data,
for example the checked or unchecked
mode of a checkbox, or the position of a slider,
then the state is best managed by the parent widget.

If the state in question is aesthetic,
for example an animation, then the
state is best managed by the widget itself.

If in doubt, start by managing state in the parent widget.

We’ll give examples of the different ways of managing state
by creating three simple examples: TapboxA, TapboxB,
and TapboxC. The examples all work similarly—each
creates a container that, when tapped, toggles between a
green or grey box. The _active boolean determines the
color: green for active or grey for inactive.

These examples use GestureDetector to capture activity
on the Container.