howljs / hl_image_picker

Simplify media selection, cropping, and camera functionality in your Flutter app. Choose images/videos from the library, crop images, and capture new photos/videos with ease.
https://pub.dev/packages/hl_image_picker
24 stars 14 forks source link

Picker with cropping enabled not working for one photo #36

Open Alexandersonn opened 4 months ago

Alexandersonn commented 4 months ago

So when I enable cropping when using the picker, it works when selecting more than one photo. However, if one photo is selected, it does not crop the photo. It shows the cropper, but the photo saved in the list is not cropped. Is this intended behavior?

VuThienHung commented 2 months ago

I am facing the same issue ^^

VuThienHung commented 2 months ago

Hi @Alexandersonn This code is worked for me

  1. Future<HLPickerItem?> _openCropper( List _selectedImages) async { final _picker = HLImagePicker(); if (_selectedImages.isEmpty) { return null; } final image = await _picker.openCropper( _selectedImages.first.path, ); return image; }

  2. var hlPickerItem = await _openCropper(hlPickerItems);

hlPickerItem = await _picker.openPicker