다중 선택, 자르기 및 사용자 정의 비율을 지원하는 인스타그램 스타일의 이미지 및 동영상 선택기 기능을 제공하는 플러터 패키지입니다. 디바이스 갤러리에서 미디어를 선택하기 위한 깔끔하고 직관적인 인터페이스를 제공하여 풍부한 미디어 업로드가 필요한 앱에 이상적입니다. 안드로이드 및 iOS 플랫폼 모두에서 최적화되어 있으며, 다양한 기기에서 일관된 성능과 사용자 경험을 보장합니다. 단순성과 커스터마이징을 고려해 제작되었으며, 기존 플러터 프로젝트에 쉽게 통합할 수 있습니다.
사용 사례
소셜 미디어 앱 사진 업로드
전자상거래 제품 이미지 선택
사용자 프로필 사진 및 비디오 업로드
미디어 배치 기능이 있는 콘텐츠 생성 도구
다중미디어 양식 제출
주요 기능
인스타그램 스타일의 UI
이미지 및 비디오 다중 선택
이미지 및 비디오 자르기
사용자 정의 가능한 종횡비
Android 및 iOS에서의 플랫폼 네이티브 성능
적합한 대상
소셜 앱을 개발하는 개발자
고급 미디어 선택이 필요한 앱
배치 미디어 처리가 필요한 프로젝트
사용자 경험 중심의 모바일 애플리케이션
네이티브처럼 보이는 피커를 원하는 플러터 개발자
고려 사항
미디어 액세스를 위해 플랫폼별 권한이 필요합니다
네이티브 종속성으로 인해 앱 크기가 증가할 수 있습니다
이미지 및 비디오 유형만 가능
자르기 기능은 추가 구성이 필요할 수 있습니다
비미디어 파일 선택에 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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.