paint method
override
//////////// ////////////
Implementation
// III.A - Paint Method
///////////////
@override
void paint(Canvas canvas, Size size) {
final Paint redPaint = Paint()..color = const Color(0xFFEA4335);
final Paint bluePaint = Paint()..color = const Color(0xFF4285F4);
final Paint greenPaint = Paint()..color = const Color(0xFF34A853);
final Paint yellowPaint = Paint()..color = const Color(0xFFFBBC05);
final double center = size.width / 2;
final double radius = size.width / 2;
// Blue arc (top right)
canvas.drawArc(
Rect.fromCircle(center: Offset(center, center), radius: radius),
-math.pi / 4, // Start at -45 degrees
math.pi / 2, // Sweep 90 degrees
true, // Use center
bluePaint,
);
// Red arc (top left)
canvas.drawArc(
Rect.fromCircle(center: Offset(center, center), radius: radius),
math.pi / 4, // Start at 45 degrees
math.pi / 2, // Sweep 90 degrees
true, // Use center
redPaint,
);
// Yellow arc (bottom left)
canvas.drawArc(
Rect.fromCircle(center: Offset(center, center), radius: radius),
3 * math.pi / 4, // Start at 135 degrees
math.pi / 2, // Sweep 90 degrees
true, // Use center
yellowPaint,
);
// Green arc (bottom right)
canvas.drawArc(
Rect.fromCircle(center: Offset(center, center), radius: radius),
5 * math.pi / 4, // Start at 225 degrees
math.pi / 2, // Sweep 90 degrees
true, // Use center
greenPaint,
);
// White center
final Paint whitePaint = Paint()..color = Colors.white;
canvas.drawCircle(
Offset(center, center),
radius * 0.65, // Inner white circle
whitePaint,
);
}