Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote Flutter que fornece um seletor de imagens e vídeos semelhante ao Instagram, com suporte para seleção múltipla, recorte e proporções personalizadas. Oferece uma interface limpa e intuitiva para selecionar mídias da galeria do dispositivo, sendo ideal para aplicativos que exigem uploads ricos em mídia. O seletor é otimizado para as plataformas Android e iOS, garantindo desempenho consistente e experiência do usuário em todos os dispositivos. Desenvolvido com simplicidade e personalização em mente, integra-se perfeitamente a projetos existentes no Flutter.
Casos de uso
Upload de fotos em aplicativos de redes sociais
Seleção de imagem de produto de comércio eletrônico
Upload de fotos e vídeos do perfil do usuário
Ferramentas de criação de conteúdo com agrupamento de mídia
Submissões de formulários multimídia
Principais recursos
Interface estilo Instagram
Seleção múltipla de imagens e vídeos
Recorte de imagem e vídeo
Proporções personalizáveis
Desempenho nativo da plataforma no Android e no iOS
Indicado para
Desenvolvedores construindo aplicativos sociais
Aplicativos que exigem seleção avançada de mídia
Projetos que exigem tratamento em lote de mídia
aplicativos móveis centrados na experiência do usuário
Desenvolvedores Flutter querendo seletores semelhantes aos nativos
Considerações
Requer permissões específicas da plataforma para acesso a mídia
Pode aumentar o tamanho do aplicativo devido às dependências nativas
Limitado a tipos de imagem e vídeo
A funcionalidade de corte pode exigir configuração adicional
Não adequado para seleção de arquivos não multimídia
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Instagram Assets Picker
An image (also with videos) picker based on Instagram picker UI. It is using the powerful flutter_wechat_assets_picker
package to handle the picker and a custom version of image_crop for crop.
Future<List<AssetEntity>?> callPicker() => InstaAssetPicker.pickAssets(
context,
pickerConfig: InstaAssetPickerConfig(
title: 'Select assets',
),
maxAssets: 10,
onCompleted: (Stream<InstaAssetsExportDetails> stream) {
// TODO : handle crop stream result// i.e : display it using a StreamBuilder// - in the same page (closeOnComplete=true)// - send it to another page (closeOnComplete=false)// or use `stream.listen` to handle the data manually in your state manager// - ...
},
);
Fields in InstaAssetsExportDetails:
Name
Type
Description
data
List<InstaAssetsExportData>
Contains the selected assets, crop parameters and possible crop file.
selectedAssets
List<AssetEntity>
Selected assets without crop
aspectRatio
double
Selected aspect ratio (1 or 4/5)
progress
double
Progress indicator of the exportation (between 0 and 1)
Fields in InstaAssetsExportData:
Name
Type
Description
croppedFile
File?
The cropped file. Can be null if video or if choose to skip crop.
selectedData
InstaAssetsCropData
The selected asset and it's crop parameter (area, scale, ratio...)
Most of the components of the picker can be customized using theme.
// set picker theme based on app theme primary colorfinal theme = InstaAssetPicker.themeData(Theme.of(context).primaryColor);
InstaAssetPicker.pickAssets(
context,
pickerConfig: InstaAssetPickerConfig(
pickerTheme: theme.copyWith(
canvasColor: Colors.black, // body background color
splashColor: Color.grey, // ontap splash color
colorScheme: theme.colorScheme.copyWith(
background: Colors.black87, // albums list background color
),
appBarTheme: theme.appBarTheme.copyWith(
backgroundColor: Colors.black, // app bar background color
titleTextStyle: Theme.of(context)
.appBarTheme
.titleTextStyle
?.copyWith(color: Colors.white), // change app bar title text style to be like app theme
),
// edit `confirm` button style
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: Colors.blue,
disabledForegroundColor: Colors.red,
),
),
),
),
onCompleted: (_) {},
);
Crop customization
You can set the list of crop aspect ratios available.
You can also set the preferred size, for the cropped assets.
InstaAssetPicker.pickAssets(
context,
pickerConfig: InstaAssetPickerConfig(
cropDelegate: InstaAssetCropDelegate(
// allows you to set the preferred size used when cropping the asset.// the final size will depends on the scale used when cropping.
preferredSize: 1080,
cropRatios: [
// - allow you to set the list of aspect ratios selectable,// the default values are [1/1, 4/5] like instagram.// - if you want to disable cropping, you can set only one parameter,// in this case, the "crop" button will not be displayed (#10).// - if the value of cropRatios is different than the default value,// the "crop" button will display the selected ratio value (i.e.: 1:1)// instead of unfold arrows.
]),
),
onCompleted: (_) {},
);
Camera
Many people requested the ability to take picture from the picker.
The main aspect of this package is selection and uniform crop selection.
Consequently, camera-related operations have no place in this package.
However, since version 2.0.0, it is now possible to trigger this action using either specialItemBuilder and/or actionsBuilder.
The ability to take a photo from the camera must be handled on your side, but the picker is now able to refresh the list and select the new photo.
New examples have been written to show how to manage this process with the camera or wechat_camera_picker package.
Video
Video are now supported on version 3.0.0. You can pick a video asset and select the crop area directly in the picker.
However, as video processing is a heavy operation it is not handled by this package.
Which means you must handle it yourself. If you want to preview the video result, you can use the InstaAssetCropTransform which will transform the Image or VideoPlayer to fit the selected crop area.