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) {
var path = Path();
if (size.height >= centreHeight) {
// Prevent curveHeight from being larger than available space
if (curveHeight > (size.height - centreHeight)) {
curveHeight = size.height - centreHeight;
}
path.lineTo(0.0, centreHeight);
// Adjusting control points of the curves to avoid the circular shape
path.quadraticBezierTo(size.width / 4, centreHeight + curveHeight,
(size.width / 2) - (0 / 2), centreHeight + curveHeight);
path.quadraticBezierTo(
(size.width / 2) - (0 / 4),
centreHeight + curveHeight,
size.width / 2,
centreHeight + curveHeight);
path.quadraticBezierTo(
(size.width / 2) + (0 / 4),
centreHeight + curveHeight - 0,
(size.width / 2) + (0 / 2),
centreHeight + curveHeight);
path.quadraticBezierTo(size.width * 3 / 4, centreHeight + curveHeight,
size.width, centreHeight);
path.lineTo(size.width, 0.0);
path.lineTo(0.0, 0.0);
} else {
path.lineTo(0.0, size.height);
path.lineTo(size.width, size.height);
path.lineTo(size.width, 0.0);
path.lineTo(0.0, 0.0);
}
return path;
}