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, AnimationController produces values that range from 0 to 1, during a given duration.
  • AnimationController generates a new value whenever Flutter needs to draw a new frame (using a Ticker)

Setting up an AnimationController requires 5 steps:

  1. Create a StatefulWidget
  2. add SingleTickerProviderStateMixin to the State class
  3. create a late final AnimationController _animationController;
  4. initialize this AnimationController in initState()
  5. Dispose it in the dispose() method

For an overview of how to reduce all the boilerplate code, see this tutorial:

Complete and Continue  
Discussion

7 comments