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
20 stars 12 forks source link

fix can't back images when touch cancel button & Cancel button cause the function holding infinitely #27

Closed HenryGaoGH closed 2 months ago

HenryGaoGH commented 2 months ago

20 Cancel button cause the function holding infinitely is fixed

fix can't back images when touch cancel button.

howljs commented 2 months ago

@HenryGaoGH Thank you for your PR. I think you will need throw error, because if you return empty array, you will not be able to know if you are unchecking the previous images or canceling the picker.

mediaPickerResult?.error("CANCELED", "User has canceled the picker", null)

Similar to the iOS handling: https://github.com/howljs/hl_image_picker/blob/464dc1e70e757b8f2e2ccb7efd1c14d4dc0d877f/hl_image_picker_ios/ios/Classes/HLImagePickerPlugin.swift#L331

howljs commented 2 months ago

I will check again and help you fix this issue right now

HenryGaoGH commented 2 months ago

@HenryGaoGH Thank you for your PR. I think you will need throw error, because if you return empty array, you will not be able to know if you are unchecking the previous images or canceling the picker.

mediaPickerResult?.error("CANCELED", "User has canceled the picker", null)

Similar to the iOS handling:

https://github.com/howljs/hl_image_picker/blob/464dc1e70e757b8f2e2ccb7efd1c14d4dc0d877f/hl_image_picker_ios/ios/Classes/HLImagePickerPlugin.swift#L331

You are right! Returning an exception is better than successfully returning an empty array

howljs commented 2 months ago
Screenshot 2024-04-24 at 10 46 17

@HenryGaoGH I checked and it's working fine. Please help me update PR and test it again. Thanks

HenryGaoGH commented 2 months ago
Screenshot 2024-04-24 at 10 46 17

@HenryGaoGH I checked and it's working fine. Please help me update PR and test it again. Thanks

yeap! I have also dealt with it

howljs commented 2 months ago

sorry. I forgot, we also need to update openCamera too. Don't need update openCropper. Let me know when you updated the PR, I will merge it. Thanks

Screenshot 2024-04-24 at 11 01 31
HenryGaoGH commented 2 months ago

sorry. I forgot, we also need to update openCamera too. Don't need update openCropper. Let me know when you updated the PR, I will merge it. Thanks

Screenshot 2024-04-24 at 11 01 31

OK, I'll deal with it after lunch. 😄

HenryGaoGH commented 2 months ago

@howljs Pls. check it and approved

howljs commented 2 months ago

The new version is available 🎉

Screenshot 2024-04-24 at 12 14 58