transform method

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

Return a transformed widget, based on child and TransformInfo

Implementation

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

    child = new Transform.scale(
      scale: scale,
      child: item,
    );
  }

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

  return child;
}