Animated task completion ring with AnimationController and AnimatedBuilder


AnimationController offers these methods to control the animation (and many others, see the documentation):

  • forward(): animation goes from the current value to upperBound (default: 1.0)
  • reverse(): animation goes from the current value to lowerBound (default: 0.0)
  • repeat(): animation repeats forever
  • stop(): stop the animation

Along with these methods to register listeners:

  • addListener(): called every time the animation value changes (don't forget to call removeListener() in dispose())
  • addStatusListener(): called when the animation status changes (don't forget to call removeStatusListener() in dispose())

To rebuild a widget when the animation value changes, use AnimatedBuilder.

AnimatedBuilder takes an animation argument of type Animation<double>.

AnimationController extends Animation<double> so it can be passed as an argument to AnimatedBuilder.

Note: AnimatedBuilder takes an optional child argument. See this article for an in-depth explanation: