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

패키지 상세v1.0.1

photo_gallery_flutter

모바일 네이티브 갤러리에서 이미지와 비디오를 검색하는 Flutter 플러그인입니다.

AndroidiOS
30일 다운로드
12
좋아요
4
Pub 점수
140

패키지 설치

flutter pub add photo_gallery_flutter

패키지 개요

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

안드로이드 및 iOS 기기의 네이티브 사진 갤러리에 저장된 이미지와 비디오에 액세스할 수 있는 플러터 플러그인입니다. 사진 편집기, 소셜 미디어 플랫폼 또는 미디어 관리 도구와 같은 갤러리 통합이 필요한 앱에 적합한 미디어 파일을 가져오는 간단한 인터페이스를 제공합니다. 이 플러그인은 두 주요 모바일 운영 체제에서 호환성과 성능을 보장하기 위해 플랫폼별 API를 활용합니다.

사용 사례

  • 사진 앱에서 네이티브 갤러리 접근 통합
  • 미디어 선택 인터페이스 구축
  • 장치 라이브러리에서 이미지/비디오 업로드 활성화
  • 로컬 미디어를 사용하여 사진 편집 도구 만들기
  • 소셜 미디어 앱 기능 개발

주요 기능

  • Android 및 iOS용 크로스 플랫폼 지원
  • 미디어 파일을 검색하는 간단한 API
  • 이미지 및 비디오에 대한 액세스
  • 네이티브 성능과 신뢰성
  • pub.dev를 통한 간편한 통합

적합한 대상

  • 미디어 중심 앱을 구축하는 플러터 개발자
  • 갤러리 브라우징 기능이 필요한 앱
  • 보안 네이티브 미디어 액세스가 필요한 프로젝트
  • 갤러리 통합을 위한 최소 설정을 원하는 개발자

고려 사항

  • 두 플랫폼 모두에서 적절한 권한이 필요합니다
  • 큰 미디어 라이브러리와 함께 제한 사항이 있을 수 있습니다
  • 기기마다 다를 수 있는 네이티브 갤러리 API에 의존합니다
  • 클라우드 기반 미디어 검색에 적합하지 않습니다
  • 갤러리 UI의 사용자 정의 제한

원본 README

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

Photo Gallery Flutter

pub package

A Flutter plugin that retrieves images and videos from mobile native gallery.

Installation

First, add photo_gallery_flutter 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.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/>

Usage

  • Listing albums in the gallery
final List<Album> imageAlbums = await PhotoGalleryFlutter.listAlbums();
final List<Album> videoAlbums = await PhotoGalleryFlutter.listAlbums(
    mediumType: MediumType.video,
    newest: false,
    hideIfEmpty: false,
);
  • Listing media in an album
final MediaPage imagePage = await imageAlbum.listMedia();
final MediaPage videoPage = await imageAlbum.listMedia(
    skip: 5,
    take: 10,
);
final List<Medium> allMedia = [
    ...imagePage.items,
    ...videoPage.items,
];
  • Loading more media in a album
if (!imagePage.isLast) {
    final nextImagePage = await imagePage.nextPage();
    // ...
}
  • Getting a Medium
final Medium medium = await PhotoGalleryFlutter.getMedium(
  mediumId: "10",
  mediumType: MediumType.image
);
  • Getting a file
final File file = await medium.getFile();
final File file = await PhotoGalleryFlutter.getFile(mediumId: mediumId);
  • Getting thumbnail data
final List<int> data = await medium.getThumbnail();
final List<int> data = await PhotoGalleryFlutter.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 PhotoGalleryFlutter.getThumbnail(
    mediumId: mediumId,
    mediumType: MediumType.image,
    width: 128,
    height: 128,
    highQuality: true,
);
  • Getting album thumbnail data
final List<int> data = await album.getThumbnail();
final List<int> data = await PhotoGalleryFlutter.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 PhotoGalleryFlutter.getAlbumThumbnail(
    albumId: albumId,
    mediumType: MediumType.image,
    newest: false,
    width: 128,
    height: 128,
    highQuality: true,
);
  • Displaying medium thumbnail

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

  • Displaying album thumbnail

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.

  • Displaying a full size image

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,
    ),
)
```# photo_gallery_flutter

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.0.2

소스 저장소

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

아직 데이터가 없습니다.