To animate these properties,
Flutter provides the AnimatedContainer widget.
Like the Container widget, AnimatedContainer allows you to define
the width, height, background colors, and more. However, when the
AnimatedContainer is rebuilt with new properties, it automatically
animates between the old and new values. In Flutter, these types of
animations are known as “implicit animations.”

This recipe describes how to use an AnimatedContainer to animate the size,
background color, and border radius when the user taps a button
using the following steps:

Create a StatefulWidget with default properties.

Build an AnimatedContainer using the properties.

Start the animation by rebuilding with new properties.

1. Create a StatefulWidget with default properties

To start, create StatefulWidget and State classes.
Use the custom State class to define the properties that change over
time. In this example, that includes the width, height, color, and border
radius. You can also define the default value of each property.