adaptive_media_picker 0.0.4
adaptive_media_picker: ^0.0.4 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
β
Falling back smartly for unsupported platforms (desktop/web)
β
Offering one simple API for images & videos
Built-in Limited Access UI (system-native UI used for full access)
π Features #
- π· Pick single image, multiple images, or single video
- π Permission-aware (handles full, limited, denied states)
- πΌοΈ Custom limited-access bottom sheet (powered by
photo_manager
) - π 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.
β‘ Quick Start #
final picker = AdaptiveMediaPicker();
// Pick a single image
final singleImage = await picker.pickImage(
context: context,
options: const PickOptions(
source: ImageSource.gallery,
imageQuality: 80,
),
);
if (singleImage.item != null) {
// use singleImage.item
}
// Pick multiple images (max 5)
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 (single image)
β
Select multiple images for an album/post
β
Pick a single video from gallery/camera
β
Handle limited-access gracefully with a ready-to-use bottom sheet
π 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
You donβt need to handle permissions manually β the picker does it for you.
βοΈ Platform Setup #
π± Android #
Add required permissions in AndroidManifest.xml
:
<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 #
Add to Info.plist
:
<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>
π» Desktop (Windows, macOS, Linux) #
- Uses
file_selector
viaimage_picker
- No runtime permissions (file dialog is native)
- Camera capture not supported
- On macOS, add to
Info.plist
:
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
π Web #
- Uses browser file picker
- Camera capture not supported
π§© API Overview #
Options #
maxImages
β Limit for multi-image pickingimageQuality
,maxWidth
,maxHeight
β Resize/compression optionssource
βImageSource.gallery
|ImageSource.camera
- Settings dialog options β
showOpenSettingsDialog
,settingsDialogTitle
,settingsDialogMessage
, etc.
Results #
PickResultSingle { item, permissionResolution }
PickResultMultiple { items, permissionResolution }
Methods #
pickImage
β Single imagepickMultiImage
β Multiple imagespickVideo
β Single video
π€ Author #
Created with β€οΈ by Jaimin Kavathia
π License #
Licensed under the MIT License β Open Source, Free to Use
β If you like this package, give it a star on GitHub & pub.flutter-io.cn!