photo_gallery
एक फ्लटर प्लगइन जो मोबाइल नेटिव गैलरी से छवियाँ और वीडियो प्राप्त करता है।
एक फ्लटर प्लगइन जो मोबाइल नेटिव गैलरी से छवियाँ और वीडियो प्राप्त करता है।
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
A Flutter plugin that retrieves images and videos from mobile native gallery.
First, add photo_gallery as a dependency in your pubspec.yaml file.
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>
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.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<manifest/>
final List<Album> imageAlbums = await PhotoGallery.listAlbums();
final List<Album> videoAlbums = await PhotoGallery.listAlbums(
mediumType: MediumType.video,
newest: false,
hideIfEmpty: false,
);
final MediaPage imagePage = await imageAlbum.listMedia();
final MediaPage videoPage = await imageAlbum.listMedia(
skip: 5,
take: 10,
);
final List<Medium> allMedia = [
...imagePage.items,
...videoPage.items,
];
if (!imagePage.isLast) {
final nextImagePage = await imagePage.nextPage();
// ...
}
final Medium medium = await PhotoGallery.getMedium(
mediumId: "10",
mediumType: MediumType.image
);
final File file = await medium.getFile();
final File file = await PhotoGallery.getFile(mediumId: mediumId);
final List<int> data = await medium.getThumbnail();
final List<int> data = await PhotoGallery.getThumbnail(mediumId: mediumId);
You can also specify thumbnail width and height on Android API 29 or higher; You can also specify thumbnail width, height and whether provider high quality or not on iOS:
final List<int> data = await medium.getThumbnail(
width: 128,
height: 128,
highQuality: true,
);
final List<int> data = await PhotoGallery.getThumbnail(
mediumId: mediumId,
mediumType: MediumType.image,
width: 128,
height: 128,
highQuality: true,
);
final List<int> data = await album.getThumbnail();
final List<int> data = await PhotoGallery.getAlbumThumbnail(albumId: albumId);
You can also specify thumbnail width and height on Android API 29 or higher; You can also specify thumbnail width, height and whether provider high quality or not on iOS:
final List<int> data = await album.getThumbnail(
width: 128,
height: 128,
highQuality: true,
);
final List<int> data = await PhotoGallery.getAlbumThumbnail(
albumId: albumId,
mediumType: MediumType.image,
newest: false,
width: 128,
height: 128,
highQuality: true,
);
ThumbnailProvider are available to display thumbnail images (here with the help of dependency transparent_image):
FadeInImage(
fit: BoxFit.cover,
placeholder: MemoryImage(kTransparentImage),
image: ThumbnailProvider(
mediumId: mediumId,
mediumType: MediumType.image,
width: 128,
height: 128,
hightQuality: true,
),
)
Width and height is only available on Android API 29+ or iOS platform
AlbumThumbnailProvider are available to display album thumbnail images (here with the help of dependency transparent_image):
FadeInImage(
fit: BoxFit.cover,
placeholder: MemoryImage(kTransparentImage),
image: AlbumThumbnailProvider(
album: album,
width: 128,
height: 128,
hightQuality: true,
),
)
Width and height is only available on Android API 29+ or iOS platform. High quality is only available on iOS platform.
You can use PhotoProvider to display the full size image (here with the help of dependency transparent_image):
FadeInImage(
fit: BoxFit.cover,
placeholder: MemoryImage(kTransparentImage),
image: PhotoProvider(
mediumId: mediumId,
),
)
निर्भरता सूची 3 आइटम
{"sdk":"flutter"}{"sdk":"flutter"}^3.0.0उपयोग के अनुसार छाँटें, गतिविधि की तुलना करें और अपनाने से पहले मूल प्रोजेक्ट की आवश्यकताएँ जाँचें।
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗