패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.5

media_gallery

네이티브 갤러리 항목을 나열하는 플러터 플러그인입니다.

30일 다운로드
28
좋아요
31
Pub 점수
30

패키지 설치

flutter pub add media_gallery

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

media_gallery 패키지는 플러터 플러그인으로, 네이티브 디바이스 갤러리 항목에 액세스할 수 있게 해 주며 사용자가 장치의 로컬 미디어 저장소에서 이미지와 비디오를 탐색하고 선택할 수 있도록 합니다. 파일 경로, 타임스탬프, 치수 등의 메타데이터가 포함된 미디어 파일을 가져오는 간단한 인터페이스를 제공합니다. 플러터 앱과 원활하게 통합되도록 설계되었으며, 안드로이드 및 iOS용 플랫폼별 구현을 지원합니다. 사진 공유, 프로필 사진 업로드, 콘텐츠 생성 도구와 같은 미디어 선택 기능이 필요한 애플리케이션에 적합합니다. 성능과 호환성을 위해 네이티브 API에 의존합니다.

사용 사례

  • 기기 갤러리에서 이미지 및 비디오 선택
  • 프로필 사진 업로드 워크플로우
  • 미디어 풍부한 앱 콘텐츠 제작
  • Flutter 앱에서 사진 앨범 탐색
  • Flutter UI에 네이티브 미디어 선택기 통합하기

주요 기능

  • 네이티브 장치 미디어 파일에 액세스
  • 이미지와 비디오 모두를 지원합니다
  • 미디어 메타데이터(경로, 타임스탬프, 크기)를 검색합니다
  • 크로스 플랫폼 호환성 (Android/iOS)
  • 미디어 목록 및 필터링을 위한 간단한 API

적합한 대상

  • 미디어 선택이 필요한 Flutter 앱
  • 소셜 미디어 또는 사진 공유 플랫폼
  • 콘텐츠 생성 도구
  • 사용자 생성 미디어 업로드를 포함한 앱
  • 사용자 정의 미디어 선택기 개발하는 개발자

고려 사항

  • 적절한 권한(카메라 및 저장소)이 필요합니다
  • 네이티브 갤러리에 한정; 클라우드 미디어 지원 없음
  • 플랫폼별 동작은 다를 수 있습니다
  • 내장된 UI 컴포넌트 없음; 사용자 정의 구현 필요
  • 대규모 미디어 라이브러리에 대해 추가 처리가 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트