Check Mobile App
Read now
Start a Project

Implicit Animation In Flutter

Save

In this blog, we are going to learn about  Implicit Animation In Flutter.  We don’t need to write code for basic animation, we can achieve animation by changing some property values of widgets.

Implicit Animation

Using implicit animations, you can animate a widget property by setting a target value. When we setState in StatefulWidget then new target values, like color, width, height, and, etc. changes with a specified duration from the old value to the new value.

Some  implicit animation Widgets:

1. AnimatedOpacity: We can hide and show widgets using opacity. Its value lies between 0 (no visibility) and 1 (visible).

2.AnimatedCrossFade: Replace one widget with another and animates itself between sizes.

3.AnimatedPositioned:  It is used to change the position of the widget to a new position with a specified duration,

4.AnimatedContainer: We can animate properties like width, height, background colors, etc. 

AnimatedContainer widget:

Let’s check implementations of AnimatedContainer

  1. Create a StatefulWidget  
  2. Declare properties with initial values _width = 50,  double _height = 50,  _color = Colors.green , _borderRadius = BorderRadius.circular(8)
  3. Add AnimatedContainer using the properties.
  4. Change the value of properties randomly on the click button and rebuild the widget with new properties.

 

 

Let’s check the final result of the code.

 

I hope this blog will help to add animation to your widgets.

Happy Learning 🙂

Reference Links :

https://flutter.dev/docs/cookbook/animation/animated-container

. . .

Leave a Comment

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


Be the first to comment.

css.php

The support is fast and do everything in their power to make it perfect. If you need customization it's also done right away. I had massive research to select Mobikul and now I'm sure it was the right one.

Igor Souza

Igor Souza

Talk to Sales

Global

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