aspectRatio property

double? get aspectRatio

Aspect ratio of the image (width / height).

The crop rectangle will be adjusted to fit this ratio. Pass null for free selection clipping (aspect ratio not enforced).

Implementation

double? get aspectRatio => value.aspectRatio;
set aspectRatio (double? newAspectRatio)

Implementation

set aspectRatio(double? newAspectRatio) {
  if (newAspectRatio != null) {
    value = value.copyWith(
      aspectRatio: newAspectRatio,
      crop: _adjustRatio(value.crop, newAspectRatio),
    );
  } else {
    value = CropControllerValue(
      null,
      value.crop,
      value.rotation,
      value.minimumImageSize,
    );
  }
  notifyListeners();
}