sizeImage static method

Size sizeImage(
  1. double currentWidth,
  2. double currentHeight, {
  3. required double targetWidth,
  4. required double targetHeight,
})

Implementation

static Size sizeImage(
  double currentWidth,
  double currentHeight, {
  required double targetWidth,
  required double targetHeight,
}) {
  double w = currentWidth;
  double h = currentHeight;
  final double wd = w / targetWidth;
  final double hd = h / targetHeight;
  final double be = math.max(1, math.max(wd, hd));
  w = w / be;
  h = h / be;
  return Size(w, h);
}