This plugin supports cropping and rotating images for Android and iOS. It Allow inclusion of background, Rotation of image, changing ratio of selection as per requirements.
ImageCropper.cropImage(
context,
imageBytes!,
() {
showLoader();
},
() {
hideLoader();
},
(data) {
setState(() {
imageBytes = data;
});
},
selectedImageRatio: ImageRatio.RATIO_1_1,
visibleOtherAspectRatios: true,
squareBorderWidth: 2,
squareCircleColor: Colors.black,
defaultTextColor: Colors.orange,
selectedTextColor: Colors.black,
colorForWhiteSpace: Colors.grey,
);
context is use to push new screen for image cropping.
image bytes is use to draw image in device and if image not fits in device screen then we manage background color(if you have passed colorForWhiteSpace or else White background) in image cropping screen.
this is a callback. you have to override and show dialog or etc when image cropping is in loading state.
this is a callback. you have to override and hide dialog or etc when image cropping is ready to show result in cropping screen.
this is a callback. you have to override and you will get Uint8List as result.
this property contains ImageRatio value. You can set the initialized a spect ratio when starting the cropper by passing a value of ImageRatio. default value is ImageRatio.FREE
this property contains boolean value. If this properties is true then it shows all other aspect ratios in cropping screen. default value is true
.
this property contains double value. You can change square border width by passing this value.
this property contains Color value. You can change square circle color by passing this value.
this property contains Color value. By passing this property you can set aspect ratios color which are unselected.
this property contains Color value. By passing this property you can set aspect ratios color which is selected.
this property contains Color value. By passing this property you can set background color, if screen contains blank space.
The result returns in Uint8List. so it can be lost later, you are responsible for storing it somewhere permanent (if needed).
Contribution towards our repository is always welcome, we request contributors to create a pull request to the develop branch only.
It would be great for us if the reporter can share the below things to understand the root cause of the issue.
- Library version
- Code snippet
- Logs if applicable
- Device specification like (Manufacturer, OS version, etc)
- Screenshot/video with steps to reproduce the issue
Image Cropper is MIT-licensed.
We’d be really happy if you send us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding our work.