adaptive_media_picker 0.0.5
adaptive_media_picker: ^0.0.5 copied to clipboard
Adaptive Flutter media picker for images & videos with smart permissions, limited access UI, and cross-platform support (Android, iOS, Web, Desktop).
πΈ Adaptive Media Picker #
π Adaptive, permission-aware media picker for Flutter
Handles limited & full access gracefully, with native-like UX across Android, iOS, Web, and Desktop.
β¨ Why Adaptive Media Picker? #
Most media pickers only open the gallery or camera β but donβt handle modern permission flows like limited access on iOS/Android.
This package makes it super easy for developers by:
β
Automatically handling permissions
β
Providing a built-in limited-access sheet
β
Optional image cropping (Android/iOS/Web)
β
Falling back smartly for unsupported platforms (desktop/web)
β
Offering one simple API for images & videos
[Pick image] [Pick multiple images] [Pick video]
Built-in Limited Access UI (system-native UI used for full access)
π Features #
- π· Pick single image, multiple images, or single video
- βοΈ Crop support for single images (Android, iOS, Web)
- π Permission-aware (handles full, limited, denied states)
- πΌοΈ Built-in limited-access bottom sheet
- π Works on mobile, web, and desktop
- π― No dart:io β safe for web builds
- π₯ Fallback to gallery when camera unavailable (e.g., web/desktop)
β οΈ Note: Multiple video selection is not supported by native APIs.
ποΈ Platform Support Matrix #
| Feature | Android | iOS | Web | macOS | Windows | Linux |
|---|---|---|---|---|---|---|
| Single image pick | β | β | β | β | β | β |
| Multi-image pick | β | β | β | β | β | β |
| Single video pick | β | β | β | β | β | β |
| Multiple videos | β | β | β | β | β | β |
| Camera capture | β | β | β | β | β | β |
| Limited-access UX | β | β | β | β | β | β |
| Cropping (single image) | β | β | β | β | β | β |
β‘ Quick Start #
final picker = AdaptiveMediaPicker();
// Pick a single image
final singleImage = await picker.pickImage(
context: context,
options: const PickOptions(
source: ImageSource.gallery,
imageQuality: 80,
),
);
// Pick a single image with cropping (Android/iOS/Web)
final croppedImage = await picker.pickImage(
context: context,
options: const PickOptions(
source: ImageSource.gallery,
wantToCrop: true,
),
);
// Pick multiple images
final multiImages = await picker.pickMultiImage(
context: context,
options: const PickOptions(maxImages: 5, source: ImageSource.gallery),
);
// Pick a single video
final singleVideo = await picker.pickVideo(
context: context,
options: const PickOptions(source: ImageSource.gallery),
);
π Common Use Cases #
β Pick profile picture (with optional crop) β Select multiple images for an album/post β Pick a single video from gallery/camera β Handle limited-access gracefully with a built-in bottom sheet
βοΈ Cropping Setup #
Cropping works for Android, iOS, and Web only. On desktop platforms cropping is ignored and the original image is returned.
Android #
Add UCropActivity to your AndroidManifest.xml:
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
(Android embedding v2 required)
iOS #
No additional configuration needed.
Web #
Add cropperjs to your web/index.html:
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.2/cropper.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.2/cropper.min.js"></script>
π Limited Access UX #
When the user grants limited access:
-
A dialog is shown with:
- Manage Selection (iOS only)
- Open Settings (iOS/macOS/Android)
-
If the user interacts, the sheet closes automatically
βοΈ Platform Setup (Permissions) #
Android #
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
iOS #
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs photo library access to pick images.</string>
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to take photos and videos.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access when recording videos.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app may save images/videos to your photo library.</string>
macOS #
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
Desktop (Windows, macOS, Linux) β uses native file dialogs. Camera not supported.
π§© API Overview #
Options #
maxImagesβ Limit for multi-image pickingimageQuality,maxWidth,maxHeightβ Resize/compression optionssourceβImageSource.gallery|ImageSource.camerawantToCropβ Enable cropping (Android/iOS/Web, single-image only)- Dialog / settings options β
showOpenSettingsDialog,settingsDialogTitle,settingsDialogMessage
Results #
PickResultSingle { item, permissionResolution }PickResultMultiple { items, permissionResolution }
Methods #
pickImageβ Single image (with optional crop)pickMultiImageβ Multiple imagespickVideoβ Single video
π€ Author #
Created with β€οΈ by Jaimin Kavathia Connect on LinkedIn
π License #
Licensed under the MIT License β Open Source, Free to Use
β If you like this package, give it a star on GitHub & pub.dev!