Building a custom implicitly animated widget
WHAT IT TESTS: understanding the implicit animation machinery. OUTLINE: extend ImplicitlyAnimatedWidget, use AnimatedWidgetBaseState, define tweens in forEachTween, read values in build.
WHAT IT TESTS: whether you know the framework scaffolding behind widgets like AnimatedContainer. ANSWER OUTLINE: extend ImplicitlyAnimatedWidget exposing target values plus duration and curve; its State extends AnimatedWidgetBaseState, which owns the AnimationController and curve. Override forEachTween to create or update Tween objects toward each new target; the base class lerps automatically when properties change. In build you read tween.evaluate(animation).
Read the original → interview
- #flutter
- #animation
- #implicitlyanimatedwidget
- #tween
- #custom-widget
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.