setColor method

void setColor(
  1. Color color
)

Sets the color of the pen to the given color.

Implementation

void setColor(Color color) {
  temporaryValue = value.map(
    drawing: (s) => ScribbleState.drawing(
      sketch: s.sketch,
      selectedColor: color.value,
      selectedWidth: s.selectedWidth,
      allowedPointersMode: s.allowedPointersMode,
    ),
    erasing: (s) => ScribbleState.drawing(
      sketch: s.sketch,
      selectedColor: color.value,
      selectedWidth: s.selectedWidth,
      allowedPointersMode: s.allowedPointersMode,
      scaleFactor: value.scaleFactor,
      activePointerIds: value.activePointerIds,
    ),
  );
}