简体   繁体   English

在 image_cropper 中扩大裁剪区域时裁剪比例发生变化 flutter

[英]crop ratio getting changed when expanding crop area in image_cropper flutter

How to lock aspect ratio when 1:1,4:3 or 16:9 crop aspect ratio select. When original ratio selected make aspect ratio unlock. How to lock aspect ratio when 1:1,4:3 or 16:9 crop aspect ratio select. When original ratio selected make aspect ratio unlock.

It is working proper in iOS, But getting issue in android platform.它在 iOS 中工作正常,但在 android 平台中出现问题。

Here is code I have used.这是我用过的代码。

  val = (await ImageCropper.cropImage(
  sourcePath: pickedFile!.path,
  compressQuality: 100,
  maxHeight: 700,
  maxWidth: 700,
  compressFormat: ImageCompressFormat.jpg,
  androidUiSettings: AndroidUiSettings(
      toolbarColor: ColorConstants.primaryColor,
      toolbarWidgetColor: ColorConstants.customBlackColor,
      lockAspectRatio: false,
      toolbarTitle: "Wood",
      activeControlsWidgetColor: ColorConstants.primaryColor),

  iosUiSettings: IOSUiSettings(
      resetButtonHidden: false,
      aspectRatioLockEnabled: false,
      rotateButtonsHidden: false,
      rotateClockwiseButtonHidden: false)))!;

For android you need to set the lockAspectRatio to true .对于 android,您需要将lockAspectRatio设置为true This is the default value.这是默认值。 You set it to false .您将其设置为false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM