getSizeScale function
Size
getSizeScale(
- dynamic degrees,
- dynamic width,
- dynamic height,
- dynamic screenWidth,
- dynamic screenHeight,
Implementation
Size getSizeScale(degrees, width, height, screenWidth, screenHeight){
double targetWidth = degrees == 0 || degrees == 180 ? screenWidth : screenHeight;
double targetHeight = degrees == 90 || degrees == 270 ? screenHeight : screenWidth;
double scaleWidth = targetWidth / width;
double scaleHeight = targetHeight / height;
double scale = scaleWidth < scaleHeight ? scaleWidth : scaleHeight;
double resizedWidth = width * scale;
double resizedHeight = height * scale;
return Size(resizedWidth, resizedHeight);
}