calculateRotationOffset method
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,
);
}