flutter_image_cropper icon indicating copy to clipboard operation
flutter_image_cropper copied to clipboard

Unable to crop image square

Open TAAkshay opened this issue 2 years ago • 2 comments

Even after setting the aspectRatioPresets to Square. I can still crop in rectangle on Android. For iOS it's working fine.

class CropperImage { static Future<CroppedFile?> imageCropping(String sourcePath) async { CroppedFile? croppedFile = await ImageCropper().cropImage( compressQuality: 60, sourcePath: sourcePath, aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1), aspectRatioPresets: [ CropAspectRatioPreset.square, // CropAspectRatioPreset.ratio3x2, // CropAspectRatioPreset.original, // CropAspectRatioPreset.ratio4x3, // CropAspectRatioPreset.ratio16x9 ], uiSettings: [ AndroidUiSettings( toolbarTitle: 'Cropper', toolbarColor: ColorsConstant.primaryColor, toolbarWidgetColor: Colors.white, initAspectRatio: CropAspectRatioPreset.square, hideBottomControls: true, lockAspectRatio: false), IOSUiSettings( title: 'Cropper', aspectRatioLockEnabled: true, minimumAspectRatio: 1.0, aspectRatioLockDimensionSwapEnabled: false, aspectRatioPickerButtonHidden: true), ], ); return croppedFile; } }

TAAkshay avatar Sep 05 '22 11:09 TAAkshay

@TAAkshay change lockAspectRatio to true. It will then react based on CropAspectRatio you defined.

ZahraVe avatar Sep 13 '22 11:09 ZahraVe