Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Updated 4 July 2023
In this blog, we will explore animated containers in Flutter. The animated version of the container gradually changes its values over a period of time.
As we all know, it is very important to make our application more interactive so that people will take more interest in our application.
The animated container will automatically animate between the old and new values of properties when they change using the provided curve and duration.
so it will going to be very interesting. We will implement it using an example. In this example, we will have a container with dynamic height.
You may also check our Flutter app development services page.
Imagine you have to build an application with bar graphs. so there can be a container with increasing or decreasing height depending on the graph values.
Let’s imagine the initial height of the container is 40.0 and the container will be like as shown below.
And now suppose you have a Button and in the onPressed method, you can change the height of the Container and setState to rebuild the UI.
But sadly, We have the following output. there is no smooth transition when we change the height values. So this looks weird for a bar chart application.
Don’t worry we will make it smooth and also interactive. We need to replace our widget only.
Now replace your ordinary container with the Animated Container widget and provide a Duration property and then see the magic happen!.
One widget replacement and one extra line of code and voila! you are animating a container now.
Isn’t it amazing? It seems very beautiful. And Also using this we can show some animations to our Flutter application.
AnimatedContainer is a very useful widget.
Congratulations!!!! you have learned how to implement Animated Container in Flutter.
For more interesting blogs check out here – https://mobikul.com/blog/
Hope this blog helped you with a better understanding of the implementation of Animated Container in Flutter.
Thanks for reading.😇
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.