build method Null safety

  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) {
  // The ImageFilter layer created by setting filterQuality will introduce
  // a saveLayer call. This is usually worthwhile when animating the layer,
  // but leaving it in the layer tree before the animation has started or after
  // it has finished significantly hurts performance.
  final bool useFilterQuality;
  switch (scale.status) {
    case AnimationStatus.dismissed:
    case AnimationStatus.completed:
      useFilterQuality = false;
      break;
    case AnimationStatus.forward:
    case AnimationStatus.reverse:
      useFilterQuality = true;
      break;
  }
  return Transform.scale(
    scale: scale.value,
    alignment: alignment,
    filterQuality: useFilterQuality ? filterQuality : null,
    child: child,
  );
}