Dự án này đã lâu không có cập nhật mới nên không còn hiển thị trên trang chủ, danh mục hay kết quả tìm kiếm — dữ liệu vẫn được giữ nguyên và trang này vẫn xem được bình thường.
RepositoryDartFRPháp
aloisdeniel

aloisdeniel/media_gallery

A Flutter plugin that lists native gallery items.

86sao
32fork
17issue
0lượt xem

Media Gallery plugin for Flutter

pub package

A Flutter plugin that lists native gallery items.

Installation

First, add media_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:

<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:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

You should also manage those permissions (for example thanks to the permission_handler plugin). You can see an example for more details.

Usage

Listing media collections

final List<MediaCollection> collections = await MediaGallery.listMediaCollections(
    mediaTypes: [MediaType.image, MediaType.video],
);

Listing medias in a collection

final MediaPage imagePage = await collection.getMedias(
    mediaType: MediaType.image,
    take: 500,
);
final MediaPage videoPage = await collection.getMedias(
    mediaType: MediaType.video,
    take: 500,
);
final List<Media> allMedias = [
    ...imageRange.items,
    ...videoRange.items,
]
..sort((x, y) => y.creationDate.compareTo(x.creationDate));

Loading more medias in a collection

if (!imagePage.isLast) {
    final nextImagePage = await imagePage.nextPage();
    // ...
}

Getting a file

final File file = await media.getFile();

Getting thumbnail data

final List<int> data = await media.getThumbnail();

Displaying thumbnails

MediaThumbnailProvider, MediaCollectionThumbnailProvider are available to display thumbnail images (here with the help of transparent_image) :

FadeInImage(
    fit: BoxFit.cover,
    placeholder: MemoryImage(kTransparentImage),
    image: MediaThumbnailProvider(
        media: media,
    ),
)

Displaying medias

You can use MediaImageProvider to display an image (here with the help of transparent_image):

FadeInImage(
    fit: BoxFit.cover,
    placeholder: MemoryImage(kTransparentImage),
    image: MediaImageProvider(
        media: media,
    ),
)

To display a video, you can use video_player.

Image/Video picker

picker

You can build a gallery picker easily with this package.

See the example for more details.

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryDart
localsend/localsend

An open-source cross-platform alternative to AirDrop

95.8k
Oct 25, 2026
RepositoryTypeScript
immich-app/immich

High performance self-hosted photo and video management solution.

117.3k
Oct 26, 2026
RepositoryDart
flutter/flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

180.4k
Oct 26, 2026
RepositoryDart
iampawan/FlutterExampleApps

[Example APPS] Basic Flutter apps, for flutter devs.

21.5k
Aug 9, 2024
RepositoryDart
CarGuo/gsy_github_app_flutter

Flutter 超完整的开源项目,功能丰富,适合学习和日常使用。GSYGithubApp 系列的优势:我们目前已经拥有 Flutter、Weex、ReactNative、Kotlin View、Kotlin Jetpack Compose ,Compose MultiPlatform,Harmony ArkUI 七个版本,功能齐全,项目框架内技术涉及面广,完成度高,持续维护,配套文章,适合全面学习,对比参考。

15.5k
Oct 21, 2026
RepositoryDart
cfug/dio

A powerful HTTP client for Dart and Flutter, which supports global settings, Interceptors, FormData, aborting and canceling a request, files uploading and downloading, requests timeout, custom adapters, etc.

12.8k
Oct 19, 2026
RepositoryDart
felangel/bloc

A predictable state management library that helps implement the BLoC design pattern

12.5k
Oct 25, 2026
RepositoryDart
flame-engine/flame

A Flutter based game engine.

10.8k
Oct 19, 2026
RepositoryDart
firebase/flutterfire

🔥 A collection of Firebase plugins for Flutter apps.

9.3k
Oct 23, 2026