colorize method

void colorize(
  1. Color color
)

Quick way to colorize all previous drawing. Applies a color filter to all fills in the drawingQueue.

This method modifies the colorFilter property of the Paint object associated with each fill in the drawingQueue.

The colorFilter applies a color to the fill while preserving the transparency of the original fill. This allows for easy color changes of shapes drawn by this Graphics object without modifying the original Paint

Implementation

void colorize(Color color) {
  for (var dq in drawingQueue) {
    if (dq?.fill != null) {
      dq?.fill?.colorFilter = ColorFilter.mode(color, BlendMode.srcATop);
    }
  }
}