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 path = Path()
    ..addPath(
        Path()
          ..lineTo(0.0, height - borderRadius.bottomLeft.y)
          ..arcToPoint(Offset(borderRadius.bottomLeft.x, height), radius: Radius.circular(borderRadius.bottomLeft.x), rotation: 180, clockwise: false)
          ..lineTo(width - borderRadius.bottomRight.x, height)
          ..arcToPoint(Offset(width, height - borderRadius.bottomRight.y), radius: Radius.circular(borderRadius.bottomRight.x), rotation: 180, clockwise: false)
          ..lineTo(width, borderRadius.topRight.y)
          ..arcToPoint(Offset(width - borderRadius.topRight.x, 0), radius: Radius.circular(borderRadius.topRight.x), rotation: 180, clockwise: false)
          ..lineTo(borderRadius.topLeft.x, 0)
          ..arcToPoint(Offset(0, borderRadius.topLeft.y), radius: Radius.circular(borderRadius.topLeft.x), rotation: 180, clockwise: false)
        ,
        position
    )
    ..addRect(Rect.fromLTWH(0.0, 0.0, size.width, size.height))
    ..fillType = PathFillType.evenOdd;

  return path;
}