getClip method

  1. @override
Path getClip(
  1. Size size
)
override

Returns a description of the clip given that the render object being clipped is of the given size.

Implementation

@override
Path getClip(Size size) {
  Path path = Path();

  switch (transitionType) {
    case StripTransitionType.LEFT_TO_RIGHT:
      path.lineTo(size.width * clipFactor, 0.0);
      path.lineTo(size.width * clipFactor, size.height);
      path.lineTo(0.0, size.height);
      break;
    case StripTransitionType.RIGHT_TO_LEFT:
      path.moveTo(size.width, 0.0);
      path.lineTo(size.width * clipFactor, 0.0);
      path.lineTo(size.width * clipFactor, size.height);
      path.lineTo(size.width, size.height);
      break;

    case StripTransitionType.TOP_TO_BOTTOM:
      path.lineTo(0.0, size.height * clipFactor);
      path.lineTo(size.width, size.height * clipFactor);
      path.lineTo(size.width, 0.0);
      break;
    case StripTransitionType.BOTTOM_TO_TOP:
      path.moveTo(0.0, size.height);
      path.lineTo(0.0, size.height * clipFactor);
      path.lineTo(size.width, size.height * clipFactor);
      path.lineTo(size.width, size.height);

      break;
  }
  path.close();
  return path;
}