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

hl_image_picker 표지
패키지 상세v1.2.16

hl_image_picker

라이브러리에서 이미지/비디오를 선택하고 이미지를 자르며 쉽게 새로운 사진/비디오를 캡처할 수 있습니다.

AndroidiOS
30일 다운로드
534
좋아요
66
Pub 점수
150

패키지 설치

flutter pub add hl_image_picker

패키지 개요

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

hl_image_picker는 디바이스 라이브러리에서 이미지 및 비디오 선택을 간소화하고, 이미지 자르기 기능을 지원하며 카메라를 통해 새로운 미디어를 직접 캡처할 수 있도록 해주는 Flutter 패키지입니다. Android와 iOS에 대해 원활한 크로스 플랫폼 경험을 제공하며 앱 내에서 미디어 파일을 관리하기 위한 직관적인 인터페이스를 제공합니다. 기존의 Flutter 프로젝트와 원활하게 통합되어 사진 또는 비디오 업로드 시 사용자 상호작용을 향상시킵니다.

사용 사례

  • 기기 라이브러리에서 이미지와 비디오 선택
  • 업로드 전에 선택한 이미지 자르기
  • 카메라를 통해 새 사진과 동영상을 캡처하기
  • 양식 워크플로에 미디어 선택 통합
  • 사용자 프로필 사진 업로드 활성화

주요 기능

  • Android 및 iOS용 크로스 플랫폼 지원
  • 내장된 이미지 자르기 기능
  • 새 미디어를 위한 카메라 캡처
  • Flutter 프로젝트와의 간편한 통합
  • 깨끗하고 사용자 정의 가능한 UI

적합한 대상

  • 미디어 업로드가 필요한 앱
  • 소셜 미디어 플랫폼
  • 사용자 프로필 관리 시스템
  • 전자상거래 제품 이미지 컬렉션
  • 사진 편집 또는 공유 애플리케이션

고려 사항

  • 카메라 및 저장소 액세스에 적절한 권한이 필요합니다
  • iOS 개인정보 설정을 위해 추가 구성이 필요할 수 있습니다
  • 기본 미디어 편집 기능에만 제한됨
  • 기반 플랫폼 카메라 API에 의존
  • 고급 비디오 처리에 적합하지 않습니다

원본 README

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

Flutter Image Picker Plugin

pub package pub package

Android iOS
Support SDK 21+ 11.0+

Simplify media selection, cropping, and camera functionality in your Flutter app. Choose images/videos from the library, crop images, and capture new photos/videos with ease.

Features:

  • Select images/videos from the library
  • Take a photo or record a video
  • Open image cropper
  • Support crop multiple images
  • Support quality compression for selected images
  • Support gif selection
iOS Android

Installation

$ flutter pub add hl_image_picker

Note: If you are developing an application exclusively for either Android or iOS, you don't need to install hl_image_picker. Instead, you can choose one of the following packages based on your target platform:

Setup

To use the plugin, you need to perform the following setup steps:

iOS
  1. Add Privacy Description to your ios/Runner/Info.plist file.
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library</string>

<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera</string>

<!-- Include this description only if your plugin requires recording videos and needs access to the device's microphone. -->
<key>NSMicrophoneUsageDescription</key>
<string>This app requires access to the microphone</string>

iOS 14 You can suppress the automatic prompting from the system by setting PHPhotoLibraryPreventAutomaticLimitedAccessAlert to yes in Info.plist

<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
<true/>

PHPhotoLibraryPreventAutomaticLimitedAccessAlert

  1. (Optional) If you want to localize the camera, open Xcode, go to the Info tab, and add the missing localizations for the camera.

localize camera

Android
  1. Make sure you set the minSdkVersion in your android/app/build.gradle file from version 21 or later:
android {
    ...
    defaultConfig {
        minSdkVersion 21
        ...
    }
}
  1. Add permissions to your AndroidManifest.xml file.
<!-- Android 12 and lower -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- Targeting Android 13 or higher -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

<!-- Request the camera permission -->
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />

<!-- Add this permission if you need to record videos -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Usage

Select images/videos from library
import 'package:hl_image_picker/hl_image_picker.dart';

final _picker = HLImagePicker();

List<HLPickerItem> _selectedImages = [];

_openPicker() async {
    final images = await _picker.openPicker(
        // Properties
    );
    setState(() {
        _selectedImages = images;
    });
}

Properties

Property Description Type
selectedIds A list of string IDs representing the initially selected images or videos from the library. This allows users to pre-select items before opening the picker. [String]
pickerOptions Additional options for the picker HLPickerOptions
cropping Indicating whether or not cropping is enabled. Just work when mediaType = MediaType.image bool
cropOptions Configuration options for the cropping functionality HLCropOptions
localized Custom text displayed for the plugin LocalizedImagePicker
Take a photo or record a video
import 'package:hl_image_picker/hl_image_picker.dart';

final _picker = HLImagePicker();

HLPickerItem? _selectedImage;

_openCamera() async {
    final image = await _picker.openCamera(
        // Properties
    );
    setState(() {
        _selectedImage = image;
    });
}

Properties

Property Description Type
cameraOptions Additional options for the camera functionality HLCameraOptions
cropping Indicating whether or not cropping is enabled bool
cropOptions Configuration options for the cropping functionality HLCropOptions
localized Custom text displayed for the plugin LocalizedImageCropper
Open image cropper
import 'package:hl_image_picker/hl_image_picker.dart';

final _picker = HLImagePicker();

HLPickerItem? _selectedImage;

_openCropper_() async {
    final image = await _picker.openCropper("image_path_to_crop",
    // Properties
    );
    setState(() {
        _selectedImage = image;
    });
}

Properties

Property Description Type
imagePath Path of the image that needs to be cropped String
cropping Indicating whether or not cropping is enabled bool
cropOptions Configuration options for the cropping functionality HLCropOptions
localized Custom text displayed for the plugin LocalizedImageCropper

Normal style

iOS Android

Circular style

iOS Android

HLPickerOptions
Property Description Default
mediaType Type of media you want to select: MediaType.image, MediaType.video,MediaType.all. MediaType.all
maxSelectedAssets The maximum number of items that can be selected. 1
minSelectedAssets The minimum number of items that must be selected.
maxFileSize The maximum allowed file size (in KB) for selected items.
minFileSize The minimum allowed file size (in KB) for selected items.
enablePreview Enables or disables the preview feature. (Press on Android and Long Press on iOS) false
convertHeicToJPG Converts HEIC format images to JPEG format when selected. (iOS Only) false
convertLivePhotosToJPG Converts Live Photos to JPEG format when selected. (iOS Only) true
isExportThumbnail Determines whether to export thumbnail for selected videos. false
thumbnailCompressQuality The compression quality (0.1-1) for exported thumbnails. 0.9
thumbnailCompressFormat The image format for exported thumbnails: CompressFormat.jpg, CompressFormat.png. CompressFormat.jpg
maxDuration The maximum duration (in seconds) for selected videos.
minDuration The minimum duration (in seconds) for selected videos.
numberOfColumn The number of items displayed per row in the picker list. 3
usedCameraButton Determines whether to show the camera button in the picker list. true
isGif Enable gif selection false
compressQuality Compress images with custom quality
compressFormat The image format for compressed images CompressFormat.jpg
maxSizeOutput Sets the maximum width and maximum height for selected images.
HLCropOptions
Property Description Default
aspectRatio Specifies the desired aspect ratio for cropping.
aspectRatioPresets Provides a set of predefined aspect ratio options for cropping.
compressQuality Determines the compression quality (0.1-1) for the exported image. 0.9
compressFormat Specifies the image format for the exported image: CompressFormat.jpg, CompressFormat.png. CompressFormat.jpg
croppingStyle Cropping style: CroppingStyle.normal, CroppingStyle.circular. CroppingStyle.normal
maxSizeOutput Sets the maximum width and maximum height for the exported image.
HLCameraOptions
Property Description Default
cameraType Specifies the type of camera to be used: CameraType.video, CameraType.image CameraType.image
recordVideoMaxSecond The maximum duration (in seconds) for recorded video.
isExportThumbnail Determines whether to export thumbnail for recorded video. false
thumbnailCompressQuality The compression quality (0.1-1) for exported thumbnail. 0.9
thumbnailCompressFormat The image format for exported thumbnail: CompressFormat.jpg, CompressFormat.png. CompressFormat.jpg
compressQuality Compress images with custom quality
compressFormat The image format for compressed images CompressFormat.jpg
maxSizeOutput Sets the maximum width and maximum height for selected images.
HLPickerItem (Response)
Property Description Type
path The path of the item. String
id The unique identifier of the item. String
name The filename of the item. String
mimeType The MIME type of the item. String
size The size of the item in bytes. int
width The width of the item int
height The height of the item int
type Indicates whether the item is an image or video. String
duration The duration of the video double?
thumbnail The path of the video thumbnail String?
LocalizedImagePicker
Property Description Default
maxDurationErrorText The error message displayed when the selected video exceeds the maximum duration. Exceeded maximum duration of the video
minDurationErrorText The error message displayed when the selected video is below the minimum duration. The video is too short
maxFileSizeErrorText The error message displayed when the selected file exceeds the maximum file size. Exceeded maximum file size
minFileSizeErrorText The error message displayed when the selected file is below the minimum file size. The file size is too small
noAlbumPermissionText The error message displayed when the app doesn't have permission to access the album. No permission to access album
noCameraPermissionText The error message displayed when the app doesn't have permission to access the camera. No permission to access camera
maxSelectedAssetsErrorText The error message displayed when the maximum number of items is exceeded. Exceeded maximum number of selected items
minSelectedAssetsErrorText The error message displayed when the minimum number of items is not met. Need to select at least {minSelectedAssets}
noRecordAudioPermissionText The error message displayed when the app doesn't have permission to record audio. No permission to record audio
gifErrorText The error message displayed when the selected file is gif and isGif=false (iOS Only) File type is not supported
doneText The text displayed on the "Done" button. Done
cancelText The text displayed on the "Cancel" button. Cancel
loadingText The text displayed when the picker is in a loading state. Loading
defaultAlbumName The name for default album. Recents
tapHereToChangeText The text displayed below defaultAlbumName. (iOS Only) Tap here to change
okText The text displayed on the "OK" button. OK
emptyMediaText The text displayed when no media is available. (iOS Only) No media available
cropDoneText The text displayed on the "Done" button. (iOS Only) Done
cropCancelText The text displayed on the "Cancel" button. (iOS Only) Cancel
cropTitleText The title displayed in the crop image screen.
LocalizedImageCropper
Property Description Default
cropDoneText The text displayed on the "Done" button. (iOS Only) Done
cropCancelText The text displayed on the "Cancel" button. (iOS Only) Cancel
cropTitleText The title displayed in the crop image screen.

ProGuard

-keep class com.luck.picture.lib.** { *; }
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }

Open-source library

iOS: TLPhotoPicker and TOCropViewController

Android: PictureSelector

카테고리

의존성

의존성 목록 3 개

  • hl_image_picker_android^1.2.11
  • hl_image_picker_ios^1.2.10
  • hl_image_picker_platform_interface^1.2.4

소스 저장소

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

아직 데이터가 없습니다.