AnimatedContainer — Flutter
AnimatedContainer Widget
The animated Container widget allow simple animation effect to be applied over the Widgets.
The AnimatedContainer
has a list of parameter some of which includes duration, curve and so on…
Here is a sample code snippet of the above.
In this example, I have animated a container that contains the a text widget as a child Text(“Connected :)”)
I have also provided a Flatbutton
that will trigger the animation of the above container.,
Thus on each onPressed()
event, the "animationValue"
is increased by a factor of 10
, hence the width of the AnimatedContainer
defined above will get updated with the new value provided by this "animationValue"
.
Since setState()
is used, it is necessary that the Widget tree should be inside a StatefulWidgetClass
.
Get the complete code here — Source Code
Output:
Video tutorial for the above : Click here
Other contributions.,
Also visit my channel for more…
vijaycreations