image_picker_cropper 0.0.3 copy "image_picker_cropper: ^0.0.3" to clipboard
image_picker_cropper: ^0.0.3 copied to clipboard

A simple wrapper combining image_picker and image_cropper into a single function call — pick and crop images in one step.

image_picker_cropper #

A lightweight Flutter wrapper package that seamlessly combines image_picker and image_cropper into a single, effortless function call to pick and crop images in one step.

Features #

  • 📸 Pick & Crop in One Step: Select an image from the Camera or Gallery and immediately open the cropper interface.
  • ⚙️ Customizable Aspect Ratios: Specify custom aspect ratios or allow users to choose from presets.
  • 🎨 Platform-Native UI Styling: Native cropping interface for Android and iOS.
  • 🚀 Simplified API: Reduces boilerplate code by combining picking and cropping logic.

Getting Started #

Add image_picker_cropper to your pubspec.yaml:

dependencies:
  image_picker_cropper: ^0.0.1

Platform Setup #

Android

Ensure UCropActivity is added to your android/app/src/main/AndroidManifest.xml within the <application> tag:

<activity
    android:name="com.yalantis.ucrop.UCropActivity"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

Also request camera/storage permissions if picking from camera/gallery:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

iOS

Add permission strings to ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>This app requires camera access to take and crop photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires photo library access to pick and crop photos.</string>

Usage #

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker_cropper/image_picker_cropper.dart';

final ImagePickerCropper _pickerCropper = ImagePickerCropper();

Future<void> pickAndCropProfileImage() async {
  final File? imageFile = await _pickerCropper.pickAndCrop(
    source: ImageSource.gallery,
    aspectRatio: const CropAspectRatio(ratioX: 1, ratioY: 1),
    toolbarTitle: 'Crop Profile Picture',
  );

  if (imageFile != null) {
    // Process or display cropped image
    print('Cropped Image Path: ${imageFile.path}');
  }
}

License #

MIT License. See LICENSE for details.

3
likes
160
points
132
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple wrapper combining image_picker and image_cropper into a single function call — pick and crop images in one step.

Repository (GitHub)
View/report issues

Topics

#image-picker #image-cropper #image #cropper #flutter

License

MIT (license)

Dependencies

cupertino_icons, flutter, image_cropper, image_picker

More

Packages that depend on image_picker_cropper