flutterimagevideopicker 0.0.1
flutterimagevideopicker: ^0.0.1 copied to clipboard
flutter Image And Video Picker Package
flutterimagevideopicker #
A Flutter plugin that retrieves images and videos from mobile native gallery.
Installation #
First, add photo_gallery as a dependency in your pubspec.yaml file.
iOS
Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist
:
NSPhotoLibraryUsageDescription
- describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
<key>NSPhotoLibraryUsageDescription</key>
<string>Example usage description</string>
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 #
- Listing albums in the gallery
import 'package:flutter/material.dart';
import 'package:flutterimagevideopicker/flutterimagevideopicker.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required String title});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
color: Colors.black,
child: FlutterImageVideoPicker(
title: "Gallery",
onTap: (value) {
print("value is $value");
}),
),
);
}
}
Width and height is only available on Android API 29+ or iOS platform
- Displaying album thumbnail