flutter_gallery_picker 0.0.4 flutter_gallery_picker: ^0.0.4 copied to clipboard
A 100% dart Flutter package for pick images and videos from gallery like whatsapp gallery.
Flutter Gallery Picker #
This a Flutter Gallery which allows you to pick image or video from gallery.
Features #
Here are some features:
- Easy, lightweight, open-source.
- Flutter Native Screens
- Gallery Like Screens
- Preview Image
- MIT licensed.
- Easily extensible.
Getting Started #
Installing #
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_gallery_picker: ^0.0.4
Import #
import 'package:flutter_gallery_picker/flutter_gallery_picker.dart';
How to use #
Android #
Add the following permissions to your AndroidManifest.xml, located in <project root>/android/app/src/main/AndroidManifest.xml
:
<manifest ...>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
...
<manifest/>
API 29+
Add the following property to your AndroidManifest.xml, located in <project root>/android/app/src/main/AndroidManifest.xml
to opt-out of scoped storage:
<manifest ...>
...
<application
android:requestLegacyExternalStorage="true"
...>
<application/>
<manifest/>
Usage #
Single #
File image = await GalleryScreen.getImage(context);
print(image);
you can use the image as File
getImage() async {
File image = await GalleryScreen.getImage(context);
// print image path
print(image.path);
// from package rflutter_alert
Alert(
context: context,
// show image from file (image)
content: Image.file(image),
).show();
}
Multi #
you can get List<File>
List<File> images = await GalleryScreen.getImage(context , multi:true);
print(images);
getImage() async {
List<File> images = await GalleryScreen.getImage(context , multi:true);
// print images list
print(images);
// from package rflutter_alert
Alert(
context: context,
// show image from file (image)
content: Image.file(image.first),
).show();
}
it's really easy :)
- You can say
Thank You
, Donate to the developer.