Animated Container in Flutter


If you are reading this article, you must already know about Container. A Container is a well-known widget in flutter. It is a widget that combines common painting, positioning, and sizing widgets. It has various well-defined properties such as coloralignmentpaddingwidth, and height. Animated Container in flutter is simply a container widget with animation.

You can use the Animated Container widget if you want to create an animation every time any value changes. AnimatedContainer works by starting an animation that plays for the given duration when the value of the property changes.

Now let’s check how can we implement Animated Container in flutter.

Create a stateful widget.


Add an Animated Container widget.

Add different properties such as width, height, color, and duration of the animation, and provide an optional curve to make the animation feel smoother.

Define width, height & color.

Altering the properties.

Add a FAB & on the onPressed function of FAB and alter the Animated Container properties by randomly generating the height, width & color of the container.



Full code:



This is how we create Animated Container in flutter.

Thanks for reading this article ❤

If I got something wrong 🙈, let me know in the comments. I would love to improve.

For more interesting blogs check out here –

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home