build method

  1. @override
Widget build(
  1. BuildContext context,
  2. Animator animator,
  3. Widget child
)
override

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(
      transform: Perspective.matrix(4.0) *
          Matrix4.translationValues(
              0.0, 0.0, animator.get("translateZ")!.value) *
          Matrix4.rotationY(-animator.get("rotateY")!.value) *
          Matrix4.identity().scaled(animator.get("scale")!.value),
      child: child,
      alignment: Alignment.center,
    ),
  );
}