getClip method
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();
// Start from bottom-left
path.moveTo(0, size.height);
// Line up to bottom of left corner
path.lineTo(0, 20);
// Top-left arc (rounded corner)
path.quadraticBezierTo(
0, // Control point X
0, // Control point Y
20, // End point X
0, // End point Y
);
// Top line to top-right arc
path.lineTo(size.width - 20, 0);
// Top-right arc (rounded corner)
path.quadraticBezierTo(
size.width, // Control point X
0, // Control point Y
size.width, // End point X
20, // End point Y
);
// Line down to bottom-right
path.lineTo(size.width, size.height);
// Close the path
path.close();
return path;
}