paint method

  1. @override
void paint(
  1. Canvas canvas,
  2. Size size
)
override

Paints the shape on the given canvas.

This method must be implemented by all concrete shape painters. It should handle the actual drawing logic for the specific shape.

canvas is the canvas to paint on. size is the size of the canvas.

Implementation

@override
void paint(Canvas canvas, Size size) {
  if (applyAfter) {
    // Draw the base painter first
    basePainter.paint(canvas, size);

    // Then apply the gradient effect
    _applyGradient(canvas, size);
  } else {
    // Apply the gradient effect first
    _applyGradient(canvas, size);

    // Then draw the base painter
    basePainter.paint(canvas, size);
  }
}