-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
I realized today the behavior of maxHeight and maxWidth is different in the following 2 scenarios.
Assumption: Image original width is 1125 and height 2000.
Scenario 1 (works as expected)
_picker.pickImage(source: Picker.ImageSource.gallery, maxHeight: 1100, maxWidth: 1100);
Result:
Image gets the following Size: Height: 1100 (as limited above), Width: 618 (adjusted proportionally, perfect)
Scenario 2 (doesn't work as expected)
_picker.pickImage(source: Picker.ImageSource.gallery, maxHeight: 1200, maxWidth: 1200);
Result:
Image gets the size of the original image: Height: 2000 (beyond the limit I set above), Width: 1125
I notice that this happens when the limit (maxHeight or maxWidth) is above the original images size. So in scenario 2, as I set maxWidth 1200, but the original image has less (1125), it allows height go beyond maxHeight.
Steps to Reproduce
Pick an image from gallery using image_picker - _picker.pickImage(source: Picker.ImageSource.gallery, maxHeight: 1200, maxWidth: 1200), using an image that has a width or height above the maxWidth or maxHeight.
Expected results:
On scenario 2, I would expect the image to get Height of 1200 (as per maxHeight), and Width of 675 (proportional equivalent)
Actual results:
On scenario 2, I got a Height above the maxHeight (2000) and width of 1125.
Logs