Flutter WeChat Camera Picker

pub package pub package GitHub stars GitHub forks Build status CodeFactor GitHub license FlutterCandies

Language: English | 中文įŽ€äŊ“

A camera picker based on WeChat's UI which is a separate runnable extension to wechat_assets_picker. The package based on camera for camera functions and photo_manager for asset implementation.

Category 🗂

Features ✨

  • â™ģī¸ Fully implementable with States override
  • 💚 99% similar to WeChat style
  • 📷 Picture taking support
  • đŸŽĨ Video recording support
    • ⏱ Duration limitation support
    • 🔍 Scale when recording support
  • ☀ī¸ Exposure adjust support
  • 🔍ī¸ Scale with pinch support
  • 💱 i18n support
    • âĒ RTL language support
  • 🎏 Fully customizable theme
  • 🖾 Foreground custom widget builder support
  • 🕹ī¸ Intercept saving with custom process

Screenshots 📸

Preparing for use 🍭

Version constraints

Flutter SDK: >=2.2.0 .


Android 13 (API 33) permissions

If you don't need to take photos or videos, consider removing relevant permission in your apps, more specifically:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    <!-- Add this if you need to take photos. -->
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <!-- Add this if you need to take videos. -->
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

Usage 📖

Simple usage

final AssetEntity? entity = await CameraPicker.pickFromCamera(context);

With configurations

Use CameraPickerConfig for more picking behaviors.

final AssetEntity? entity = await CameraPicker.pickFromCamera(
  pickerConfig: const CameraPickerConfig(),

Fields in CameraPickerConfig:

NameTypeDescriptionDefault Value
enableRecordingboolWhether the picker can record video.false
onlyEnableRecordingboolWhether the picker can only record video. Only available when enableRecording is true.false
enableTapRecordingboolWhether allow the record can start with single tap. Only available when enableRecording is true.false
enableAudioboolWhether Whether the picker should record audio. Only available with recording.true
enableSetExposureboolWhether users can set the exposure point by tapping.true
enableExposureControlOnPointboolWhether users can adjust exposure according to the set point.true
enablePinchToZoomboolWhether users can zoom the camera by pinch.true
enablePullToZoomInRecordboolWhether users can zoom by pulling up when recording video.true
shouldDeletePreviewFileboolWhether the preview file will be delete when pop.false
shouldAutoPreviewVideoboolWhether the video should be played instantly in the preview.false
maximumRecordingDurationDurationThe maximum duration of the video recording process.const Duration(seconds: 15)
themeThemeData?Theme data for the picker.CameraPicker.themeData(wechatThemeColor)
textDelegateCameraPickerTextDelegate?Text delegate that controls text in widgets.CameraPickerTextDelegate
resolutionPresetResolutionPresetPresent resolution for the camera.ResolutionPreset.max
cameraQuarterTurnsintThe number of clockwise quarter turns the camera view should be rotated.0
imageFormatGroupImageFormatGroupDescribes the output of the raw image format.ImageFormatGroup.unknown
preferredLensDirectionCameraLensDirectionWhich lens direction is preferred when first using the camera.CameraLensDirection.back
lockCaptureOrientationDeviceOrientation?Whether the camera should be locked to the specific orientation during captures.null
foregroundBuilderForegroundBuilder?The foreground widget builder which will cover the whole camera preview.null
previewTransformBuilderPreviewTransformBuilder?The widget builder which will transform the camera preview.null
onEntitySavingEntitySaveCallback?The callback type define for saving entity in the viewer.null
onErrorCameraErrorHandler?The error handler when any error occurred during the picking process.null
onXFileCapturedXFileCapturedCallback?The callback type definition when the XFile is captured by the camera.null

Using custom States

All user interface can be customized through custom States, including:

  • CameraPickerState
  • CameraPickerViewerState

After override States, pass them through the picking method, more specifically:

  • CameraPicker.pickFromCamera(createPickerState: () => CustomCameraPickerState());
  • CameraPickerViewer.pushToViewer(..., createViewerState: () => CustomCameraPickerViewerState());

Frequently asked question 💭

Why the orientation behavior is strange on iOS?

Currently, the preview is not correctly synced on the iOS. You can find more details in this issue: https://github.com/flutter/flutter/issues/89216 . Other than that, please submit issues to describe your question.

Contributors ✨

Thank goes to these wonderful people (emoji key):

Alex Li

đŸ’ģ 🎨 📖 💡 🤔 🚧 đŸ’Ŧ 👀


💡 🤔




đŸ’ģ 🤔


đŸ’ģ 🤔



Luong The Vinh



ī¸ī¸ī¸ī¸â™ŋī¸ 🐛



This project follows the all-contributors specification. Contributions of any kind welcome!