calculateRotationOffset method

Offset calculateRotationOffset(
  1. Size size,
  2. double degree
)

Implementation

Offset calculateRotationOffset(Size size, double degree) {
  final rotatedHeight = (size.width * math.sin(radians(degree))).abs() +
      (size.height * cos(radians(degree))).abs();
  final rotatedWidth = (size.width * cos(radians(degree))).abs() +
      (size.height * sin(radians(degree))).abs();
  return Offset(
    (size.width - rotatedWidth) / 2,
    (size.height - rotatedHeight) / 2,
  );
}