build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Override this method to build widgets that depend on the state of the listenable (e.g., the current value of the animation).

Implementation

@override
Widget build(BuildContext context) {
  final double angle = animation.value * pi;
  final bool isUnder = (animation.value > 0.5);

  return Transform(
    transform: (axis == Axis.horizontal)
        ? (Matrix4.rotationY(angle))
        : (Matrix4.rotationX(angle)),
    alignment: alignment,
    child: isUnder
        ? Transform(
            transform: (axis == Axis.horizontal)
                ? (Matrix4.rotationY(pi))
                : (Matrix4.rotationX(pi)),
            alignment: alignment,
            child: child,
          )
        : child,
  );
}