Skip to content

Commit 6ea1884

Browse files
author
Yan Kochkin
committed
cropSizeToPaint calculation fix
1 parent abcc472 commit 6ea1884

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/calculators/calculate_crop_params.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ CropFitParams calculateCropParams({
1616
switch (imageFit) {
1717
case CustomImageFit.fitCropSpace:
1818
final cropSize = min(screenWidth, screenHeight);
19-
final cropSizeToPaint = cropSize;
19+
final cropSizeToPaint = cropSize * cropPercentage;
2020
final defaultScale = (cropSize * cropPercentage) / max(imageWidth, imageHeight);
2121

2222
return CropFitParams(cropSize, cropSizeToPaint, defaultScale);
2323

2424
case CustomImageFit.fillCropWidth:
2525
final cropSize = screenWidth;
26-
final cropSizeToPaint = cropSize;
26+
final cropSizeToPaint = cropSize * cropPercentage;
2727
final defaultScale = (cropSize * cropPercentage) / imageWidth;
2828

2929
return CropFitParams(cropSize, cropSizeToPaint, defaultScale);
3030
case CustomImageFit.fillCropHeight:
3131
final cropSize = screenHeight;
32-
final cropSizeToPaint = cropSize;
32+
final cropSizeToPaint = cropSize * cropPercentage;
3333
final defaultScale = (cropSize * cropPercentage) / imageHeight;
3434

3535
return CropFitParams(cropSize, cropSizeToPaint, defaultScale);

0 commit comments

Comments
 (0)