Make Animation in Flutter Application Using AnimatedContainer Widget


Flutter has a lot of widgets to help with explicit animations, ones that you, the developer, code up. But there are also widgets for implicit animations, those that animate changes for you. A good one to know is AnimatedContainer Widget.

You can build it once with a particular attribute, like color. And when you rebuild it with a different value, the response will get to a setState call. AnimatedContainer performs a linear interpolation between the two values.

And it's more than just colors. You can animate borders, border radii, background images, shadows, gradients, shapes, padding, width, height, alignment, transforms and more.

AnimatedContainer Widget

One more thing is the length of the animation is controlled by the duration parameter, and also we can specify our own curve to customize the effect.

Not only AnimatedContainer widget is for animation, there are a bunch of other widgets to help with implicit animations, too.

Here is the example of Animated Widget.

This is all about AnimatedContainer Widget. Hope this is helpful.

Next Post »