Intro to TweenAnimationBuilder
Notes
There are cases where none of the built-in implicitly animated widgets are what you're looking for.
And you can build your own using TweenAnimationBuilder
.
This takes a tween, duration and builder argument:
TweenAnimationBuilder<double>( tween: Tween<double>(begin: 0.0, end: 1.0), duration: Duration(milliseconds: 1500), builder: (context, value, child) { // return a widget using the interpolated value }, )
The tween
parameter is used to animate between values of a specific type (e.g. double
, Offset
, Color
).
Reminder: Dart is a statically typed language, and you should always specify what kind of Tween
you want.
In the upcoming lesson we'll see how to use TweenAnimationBuilder
to animate between HSL colors. For a more in-depth explanation of HSL colors, see this:
Playground
You can code along with this lesson with this example on Dartpad:
9 comments