Flutter plugin for selecting images/videos from the Android and iOS image library, and taking pictures/videos with the camera
ios(10+): ZLPhotoBrowser
android(21+): PictureSelector
This plugin is learn from lisen87/image_pickers
Don’t need to set localizations,the plugin will follow system
For ios:
<key>NSCameraUsageDescription</key>
<string>Example usage description</string>
<key>NSMicrophoneUsageDescription</key>
<string>Example usage description</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Example usage description</string>
For android:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
And,
images_picker: ^newest
import "package:images_picker/images_picker.dart";
Future getImage() async {
List<Media> res = await ImagesPicker.pick(
count: 3,
pickType: PickType.image,
);
// Media
// .path
// .thumbPath (path for video thumb)
// .size (kb)
}
ImagesPicker.openCamera(
pickType: PickType.video,
maxTime: 15, // record video max time
);
ImagesPicker.pick(
// ...
gif: true, // default is true
);
ImagesPicker.pick(
// ...
// when cropOpt isn't null, crop is enabled
cropOpt: CropOption(
aspectRatio: CropAspectRatio.custom,
cropType: CropType.rect, // currently for android
),
);
ImagesPicker.pick(
// ...
// when maxSize/quality isn't null, compress is enabled
quality: 0.8, // only for android
maxSize: 500, // only for ios (kb)
);
// for pick
int count = 1,
PickType pickType = PickType.image,
bool gif = true,
CropOption cropOpt,
int maxSize,
double quality,
// for camera
PickType pickType = PickType.image,
int maxTime = 15,
CropOption cropOpt,
int maxSize,
double quality,
Author: chavesgu
Source Code: https://github.com/chavesgu/images_picker
#flutter #dart #mobile-apps