Flutter Image Picker problem on iOS, pop-up with "Select more photos" even if I want to select only one, the image is not added

358

Based on this discussion https://github.com/flutter/flutter/issues/65995, I find out that it's a common bug on iOS.

I solved this issue by adding:

 image_picker:
    git:
      url: https://github.com/cpboyd/plugins.git
      ref: ios-no-permissions
      path: packages/image_picker/image_picker

Using this branch, it will remove the pop-up.

Share:
358
Roland Iordache
Author by

Roland Iordache

Updated on January 04, 2023

Comments

  • Roland Iordache
    Roland Iordache over 1 year

    I am using Image Picker to select an image from the gallery. When I don't have any images uploaded, after I add one image, this pop-up is appearing as shown below. enter image description here

    If I press "Select More Photos...", the image or images are not added after selection. How to get rid of this pop-up or what do I need to change in my code to be able to Select More Photos if he wants. I read that Image Picker is unable to handle picking multiple images once, and I don't need that necessarily, so I need to get rid of this pop-up, because even if I select only one image from "Select more photos...", it is not added.

     void _openCameraAndAddPossibleImage(String? cleverClosetOrganizer, String cameraOrGallery, int isMyClosetCheck) async{
        try{
          var pickedFile = await ImagePicker().pickImage(
            source: cameraOrGallery == 'camera' ? ImageSource.camera : ImageSource.gallery,
          );
          if (pickedFile != null) {
            var imageFile = File(pickedFile.path);
            Uint8List imageRaw = await imageFile.readAsBytes();
            String newImage = CleverCloset.base64String(imageRaw);
            if (mounted) {
            setState(() {
              if(isMyClosetCheck==1) {
                CleverCloset cleverClosetToAdd = CleverCloset(closetOrganizer: cleverClosetOrganizer, isMyCloset: isMyClosetCheck, image: newImage);
                addImageOnClosetOrganizer(cleverClosetToAdd);
              }
              else {
                CleverCloset cleverClosetToAdd = CleverCloset(isMyCloset: isMyClosetCheck, image: newImage);
                addImageOnToBuy(cleverClosetToAdd);
              }
            });
    
            }
          }
        }
       catch (e){
          return ;
       }
    
      }
    

    enter image description here

    • Zakaria Hossain
      Zakaria Hossain about 2 years
      Post your crash log here.
    • fsbelinda
      fsbelinda about 2 years
      Actually you have to choose "keep current selection" since it's just one picture.
    • Roland Iordache
      Roland Iordache about 2 years
      Yes, I have to choose "keep current selection", but the pop-up should not exist. I will post the crash log immediately.
    • Roland Iordache
      Roland Iordache about 2 years
      Sorry, I modified the question, because I don't have any error log, the images are not added, and that's all, if I press "Select more photos...". I will add a Gif workaround.
    • fsbelinda
      fsbelinda about 2 years
      I have used the package before and it worked the same way. I think it's just the way it works. You go to Gallery, choose a picture and the pop-up appears then you have to choose "keep current selection"(probably is like an OK button to confirm your selection).