A flutter package to scale and crop images. Optionally set aspect ratio of cropping area
Add image_cropper
to your pubspec.yaml
:
dependencies:
flutter:
sdk: flutter
# added below
image_cropper: <latest version>
When you have the image file navigate to Crop
widget provided by the package
Future<Null> _cropImage() async {
var file = await imageFile.readAsBytes();
Navigator.of(context).push(MaterialPageRoute(
builder: (context) {
return ic.Crop(
controller: _cropController,
image: file,
);
},
)).then((image) {
setState(() {
if (image != null) {
croppedImage = image;
state = AppState.cropped;
}
});
});
}
- Follow us on Twitter: @codetoart
- Contact us on Website: codetoart