getSizeScale method

Size getSizeScale(
  1. dynamic degrees,
  2. dynamic width,
  3. dynamic height,
  4. dynamic screenWidth,
  5. dynamic screenHeight,
)

Implementation

Size getSizeScale(degrees, width, height, screenWidth, screenHeight){
  double targetWidth = screenWidth;
  double targetHeight = screenHeight;

  double scaleWidth = targetWidth / width;
  double scaleHeight = targetHeight / height;

  double scale = scaleWidth < scaleHeight ? scaleWidth : scaleHeight;

  sizeScale = scale;

  double resizedWidth = width * scale;
  double resizedHeight = height * scale;

  if(resizedHeight > 0.8 * getScreenHeight() - appBarHeight){
    resizedHeight = 0.8 * getScreenHeight() - appBarHeight;
  }

  if(resizedWidth < getScreenWidth()){
    resizedWidth = getScreenWidth();
  }

  return Size(resizedWidth, resizedHeight);
}