Introduction to explicit animations with AnimationController
Notes
AnimationController is a class that we can use to play an animation forward or in reverse,
- by default,
AnimationControllerproduces values that range from 0 to 1, during a given duration. AnimationControllergenerates a new value whenever Flutter needs to draw a new frame (using aTicker)
Setting up an AnimationController requires 5 steps:
- Create a
StatefulWidget - add
SingleTickerProviderStateMixinto theStateclass - create a
late final AnimationController _animationController; - initialize this
AnimationControllerininitState() - Dispose it in the
dispose()method
For an overview of how to reduce all the boilerplate code, see this tutorial:
7 comments