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) {
  final rect = Rect.fromLTRB(
      -size.width, -size.width, size.width * 2, size.height * 2);
  final double width = size.width - thickness * 2;
  final double height = size.height - thickness * 2;

  final borderPath = Path();
  borderPath.fillType = PathFillType.evenOdd;
  borderPath.addRRect(RRect.fromRectAndRadius(
      Rect.fromLTWH(thickness, thickness, width, height),
      Radius.circular(radius - thickness)));
  borderPath.addRect(rect);

  return borderPath;
}