Using premade animation transitions
You can use transition widgets to create animations in an easier way than using traditional animations. The Flutter framework contains several pre-made transitions, which makes animating objects extremely straightforward. These include:
DecoratedBoxTransition
FadeTransition
PositionedTransition
RotationTransition
ScaleTransition
SizeTransition
SlideTransition
In this recipe, you will use the FadeTransition
widget, but the same animation rules that you will see for FadeTransition
apply to the other transitions in the Flutter framework.
In particular, you will make a square appear slowly on the screen, over a specified duration of time:
Figure 12.6: A square appearing with FadeTransition
Getting ready
To follow along with this recipe, you need any existing Flutter project already created, or you can use the app created in any of the previous recipes.