Skip to content

[Image_picker]: Image gallery opens twice if we choose select photos permission. #78108

@romaklym

Description

@romaklym

Hello!
I have an issue when I'm trying to pick an image from a gallery. It pops out twice, the first time allowing me to chose an image, and after I've done that and pressed "Select" it instantly pops-out a second time, during which I cannot choose any images. This happens only on iPhone emulators.
Have no issues in the debugger either.

When I hit the button to upload an image: I get the next pop out:
Screenshot 2021-03-13 at 14 53 20
Then I hit "Choose from Gallery" and Gallery opens up with the ability to chose a picture, so I do that, and after that, I hit "Select" and Gallery shuts down, and instantly opens up again, with no option to chose image again, only a button to quit.

I'm running my app on the latest M1 MacBook, on iOS 14.4
pubspec.yaml:

version: 1.0.0+1

environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  cloud_firestore: ^0.13.2+1
  firebase_auth: ^0.15.4
  shared_preferences: ^0.5.6+1
  fluttertoast: ^3.1.3
  image_picker: ^0.6.7+4
  firebase_storage: ^3.1.1
  firebase_core: ^0.4.0+9
  flutter_staggered_grid_view: ^0.3.0
  provider: ^4.0.4
  path_provider: ^2.0.1
  image: ^2.0.7
  intl:

Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>salo</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>$(FLUTTER_BUILD_NAME)</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>$(FLUTTER_BUILD_NUMBER)</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UIViewControllerBasedStatusBarAppearance</key>
	<false/>
	<key>NSPhotoLibraryUsageDescription</key>
	<string>App wants to access your gallery</string>
	<key>NSCameraUsageDescription</key>
	<string>App wants to access your camera</string>
	<key>NSMicrophoneUsageDescription</key>
	<string>App wants to access your microphone</string>
</dict>
</plist>

My Code:

capturePhotoWithCamera() async {
    Navigator.pop(context);
    File imageFile = await ImagePicker.pickImage(
        source: ImageSource.camera, maxHeight: 680.0, maxWidth: 970.0);
    setState(() {
      file = imageFile;
    });
  }

  pickPhotoFromGallery() async {
    Navigator.pop(context);
    File imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
    setState(() {
      file = imageFile;
    });
  }

flutter doctor --verbose:

[✓] Flutter (Channel dev, 2.1.0-12.1.pre, on macOS 11.2.3 20D91 darwin-arm, locale en-UA)
    • Flutter version 2.1.0-12.1.pre at /Users/romanklym/Developer/flutter
    • Framework revision 8264cb3e8a (3 days ago), 2021-03-10 12:37:57 -0800
    • Engine revision 711ab3fda0
    • Dart version 2.13.0 (build 2.13.0-116.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/romanklym/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • 9D45517E-18FC-40A3-B109-BB8FC96F7675 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 89.0.4389.82

If you need any more info, feel free to ask. Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: qualityA truly polished experiencefound in release: 2.0Found to occur in 2.0has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: image_pickerThe Image Picker plugin.packageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions