drawRotated method

void drawRotated({
  1. required Size size,
  2. Offset rotationOffset = Offset.zero,
  3. Offset drawOffset = Offset.zero,
  4. required double angle,
  5. required DrawCallback drawCallback,
})

Handles performing multiple draw actions rotated.

Implementation

void drawRotated({
  required Size size,
  Offset rotationOffset = Offset.zero,
  Offset drawOffset = Offset.zero,
  required double angle,
  required DrawCallback drawCallback,
}) {
  save();
  translate(
    rotationOffset.dx + drawOffset.dx + size.width / 2,
    rotationOffset.dy + drawOffset.dy + size.height / 2,
  );
  rotate(Utils().radians(angle));
  translate(
    -drawOffset.dx - size.width / 2,
    -drawOffset.dy - size.height / 2,
  );
  drawCallback();
  restore();
}