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
ui.Path getClip(ui.Size size) {
  final customRadius =
      isCircle ? Radius.circular(area.height) : const Radius.circular(3.0);

  final rect = Rect.fromLTRB(
    area.left - overlayPadding.left,
    area.top - overlayPadding.top,
    area.right + overlayPadding.right,
    area.bottom + overlayPadding.bottom,
  );

  return Path()
    ..fillType = ui.PathFillType.evenOdd
    ..addRect(Offset.zero & size)
    ..addRRect(
      RRect.fromRectAndCorners(
        rect,
        topLeft: (radius?.topLeft ?? customRadius),
        topRight: (radius?.topRight ?? customRadius),
        bottomLeft: (radius?.bottomLeft ?? customRadius),
        bottomRight: (radius?.bottomRight ?? customRadius),
      ),
    );
}