transform method

  1. @override
Widget transform(
  1. Widget child,
  2. TransformInfo info
)
override

Return a transformed widget, based on child and TransformInfo

Implementation

@override
Widget transform(Widget child, TransformInfo info) {
  final position = info.position;
  var c = child;
  if (_scale != null) {
    final scaleFactor = (1 - position!.abs()) * (1 - _scale!);
    final scale = _scale! + scaleFactor;

    c = Transform.scale(
      scale: scale,
      child: c,
    );
  }

  if (_fade != null) {
    final fadeFactor = (1 - position!.abs()) * (1 - _fade!);
    final opacity = _fade! + fadeFactor;
    c = Opacity(
      opacity: opacity,
      child: c,
    );
  }

  return c;
}