build method
AnimatorWidget calls build to retrieve the animated Widget. The extracted Animator from the getDefinition phase is injected to supply a controller and the Animation objects. Example: @override Widget build(BuildContext context, Animator animator, Widget child) { return FadeTransition( opacity: animation.get('opacity'), child: child, ); }
Implementation
@override
Widget build(BuildContext context, Animator animator, Widget child) {
return AnimatedBuilder(
animation: animator.controller!,
child: child,
builder: (BuildContext context, Widget? child) => Transform(
child: child,
transform: Matrix4.translationValues(
animator.get("translateX")!.value, 0.0, 0.0),
alignment: FractionalOffset(0.5, 0.5),
),
);
}