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) {
  var path = Path();
  path
    ..moveTo(0, 0)
    ..lineTo(0, max(fromTop - radius, 0))
    ..arcToPoint(Offset(radius, fromTop),
        clockwise: true, radius: Radius.circular(radius))
    ..arcToPoint(Offset(0, fromTop + radius),
        clockwise: true, radius: Radius.circular(radius))
    ..lineTo(0, size.height)
    ..lineTo(size.width, size.height)
    ..lineTo(size.width, fromTop + radius)
    ..arcToPoint(Offset(size.width - radius, fromTop),
        clockwise: true, radius: Radius.circular(radius))
    ..arcToPoint(Offset(size.width, max(fromTop - radius, 0)),
        radius: Radius.circular(radius))
    ..lineTo(size.width, 0)
    ..close();
  return path;
}