A pure-Dart Flutter image cropper. Works identically on Android, iOS, web, desktop, and embedded. No platform channels.
dependencies:
flutter_crop_kit: ^0.1.0final controller = CropController(
source: ImageSource.asset('assets/photo.png'),
aspectRatio: CropAspectRatio.r16x9,
);
CropView(controller: controller);
// then: final bytes = await controller.crop();final bytes = await showCropper(
context,
source: ImageSource.network('https://example.com/photo.png'),
mask: const MaskShape.circle(),
);- Rect, circle, oval, polygon, and custom
Pathmasks. - Aspect ratio lock (free, presets, custom).
- 90 degree quick rotation and free rotation.
- Pinch-zoom and pan.
- Grid overlay (thirds, golden, 3x3).
- 4 input sources: memory, file, network, asset.
- PNG output and live
Stream<Rect>of the crop rect. - Themed via
CropTheme.
ImageSource.memory(Uint8List bytes);
ImageSource.file(File file);
ImageSource.network(String url, {Map<String, String>? headers});
ImageSource.asset(String path, {AssetBundle? bundle});const MaskShape.rect();
const MaskShape.oval();
const MaskShape.circle();
MaskShape.polygon([Offset(0, 0), Offset(1, 0), Offset(0.5, 1)]); // unit space
MaskShape.custom((rect) => Path()..addRRect(RRect.fromRectXY(rect, 12, 12)));CropController.error exposes a CropException. CropView accepts errorBuilder and loadingBuilder.
CI runs golden tests only on Linux. Locally:
flutter test --update-goldensCreated and maintained by Pranav.
Contributions, issues, and feature requests welcome at github.com/Pranavmaid/flutter_crop_kit.
MIT © Pranav.