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();

  if (type == MessageType.SEND) {
    path.addRRect(RRect.fromLTRBR(
        0, 0, size.width, size.height, Radius.circular(bubbleRadius)));
    var path2 = Path();
    path2.addRRect(RRect.fromLTRBAndCorners(0, 0, bubbleRadius, bubbleRadius,
        bottomRight: Radius.circular(fourthEdgeRadius)));
    path.addPath(
        path2, Offset(size.width - bubbleRadius, size.height - bubbleRadius));
  } else {
    path.addRRect(RRect.fromLTRBR(
        0, 0, size.width, size.height, Radius.circular(bubbleRadius)));
    var path2 = Path();
    path2.addRRect(RRect.fromLTRBAndCorners(0, 0, bubbleRadius, bubbleRadius,
        bottomLeft: Radius.circular(fourthEdgeRadius)));
    path.addPath(path2, Offset(0, 0));
  }

  path.close();
  return path;
}