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();
final width = size.width;
final height = size.height;
final centerX = width / 2;
final centerY = height / 2;
final radius = width / 2;
final angle = (2 * math.pi) / 6;
final rotation = -math.pi / 2; // Rotate so a point is at the top
path.moveTo(
centerX + radius * math.cos(rotation),
centerY + radius * math.sin(rotation),
);
for (int i = 1; i <= 6; i++) {
path.lineTo(
centerX + radius * math.cos(rotation + i * angle),
centerY + radius * math.sin(rotation + i * angle),
);
}
path.close();
return path;
}