Animated task completion ring with AnimationController and AnimatedBuilder
Notes
AnimationController
offers these methods to control the animation (and many others; see the documentation):
forward()
: animation goes from the current value toupperBound
(default:1.0
)reverse()
: animation goes from the current value tolowerBound
(default:0.0
)repeat()
: animation repeats foreverstop()
: stop the animation
Along with these methods to register listeners:
addListener()
: called every time the animation value changes (don't forget to callremoveListener()
indispose()
)addStatusListener()
: called when the animation status changes (don't forget to callremoveStatusListener()
indispose()
)
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:
0 comments