Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev1.0.1

photo_gallery_flutter

Um plugin Flutter que recupera imagens e vídeos da galeria nativa do dispositivo móvel.

AndroidiOS
Downloads em 30 dias
12
Curtidas
4
Pontos Pub
140

Instalar pacote

flutter pub add photo_gallery_flutter

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Um plugin Flutter que permite o acesso a imagens e vídeos armazenados na galeria nativa de fotos nos dispositivos Android e iOS. Ele fornece uma interface simples para recuperar arquivos multimídia, sendo ideal para aplicativos que exigem integração com a galeria, como editores de fotos, plataformas de mídia social ou ferramentas de gerenciamento de mídia. O plugin utiliza APIs específicas da plataforma para garantir compatibilidade e desempenho em ambos os principais sistemas operacionais móveis.

Casos de uso

  • Integrando o acesso nativo à galeria em aplicativos de fotos
  • Construindo interfaces de seleção de mídia
  • Habilitar uploads de imagens/vídeos da biblioteca do dispositivo
  • Criando ferramentas de edição de fotos com mídia local
  • Desenvolvendo recursos de aplicativos de mídia social

Principais recursos

  • Suporte multiplataforma para Android e iOS
  • API simples para recuperar arquivos de mídia
  • Acesso a imagens e vídeos
  • Desempenho nativo e confiabilidade
  • Integração fácil por meio do pub.dev

Indicado para

  • Desenvolvedores Flutter construindo aplicativos com grande volume de mídia
  • Aplicativos que precisam de capacidades de navegação na galeria
  • Projetos que exigem acesso seguro a mídia nativa
  • Desenvolvedores procurando configuração mínima para integração de galeria

Considerações

  • Requer permissões apropriadas em ambas as plataformas
  • Pode ter limitações com bibliotecas de mídia grandes
  • Depende de APIs nativas de galeria que podem variar conforme o dispositivo
  • Não adequado para recuperação de mídia baseada em nuvem
  • Personalização limitada da interface do galeria

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

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

Categorias

Dependências

Lista de dependências 1 itens

  • plugin_platform_interface^2.0.2

Repositório-fonte

Projetos que usam este pacote

Ainda não há dados.