CropRotateEditorConfigs constructor

const CropRotateEditorConfigs({
  1. double desktopCornerDragArea = 7,
  2. double mobileCornerDragArea = kMinInteractiveDimension,
  3. bool enabled = true,
  4. bool canRotate = true,
  5. bool canFlip = true,
  6. bool enableDoubleTap = true,
  7. bool transformLayers = true,
  8. bool canChangeAspectRatio = true,
  9. bool canReset = true,
  10. bool reverseMouseScroll = false,
  11. bool reverseDragDirection = false,
  12. bool roundCropper = false,
  13. double? initAspectRatio,
  14. Curve rotateAnimationCurve = Curves.decelerate,
  15. Curve scaleAnimationCurve = Curves.decelerate,
  16. Curve cropDragAnimationCurve = Curves.decelerate,
  17. Curve fadeInOutsideCropAreaAnimationCurve = Curves.decelerate,
  18. RotateDirection rotateDirection = RotateDirection.left,
  19. Duration opacityOutsideCropAreaDuration = const Duration(milliseconds: 100),
  20. Duration animationDuration = const Duration(milliseconds: 250),
  21. Duration fadeInOutsideCropAreaAnimationDuration = const Duration(milliseconds: 350),
  22. Duration cropDragAnimationDuration = const Duration(milliseconds: 400),
  23. double maxScale = 7,
  24. double mouseScaleFactor = 0.1,
  25. double doubleTapScaleFactor = 2,
  26. List<AspectRatioItem> aspectRatios = const [AspectRatioItem(text: 'Free', value: -1), AspectRatioItem(text: 'Original', value: 0.0), AspectRatioItem(text: '1*1', value: 1.0 / 1.0), AspectRatioItem(text: '4*3', value: 4.0 / 3.0), AspectRatioItem(text: '3*4', value: 3.0 / 4.0), AspectRatioItem(text: '16*9', value: 16.0 / 9.0), AspectRatioItem(text: '9*16', value: 9.0 / 16.0)],
})

Creates an instance of CropRotateEditorConfigs with optional settings.

By default, all options are enabled, and the initial aspect ratio is set to CropAspectRatios.custom.

Implementation

const CropRotateEditorConfigs({
  this.desktopCornerDragArea = 7,
  this.mobileCornerDragArea = kMinInteractiveDimension,
  this.enabled = true,
  this.canRotate = true,
  this.canFlip = true,
  this.enableDoubleTap = true,
  this.transformLayers = true,
  this.canChangeAspectRatio = true,
  this.canReset = true,
  this.reverseMouseScroll = false,
  this.reverseDragDirection = false,
  this.roundCropper = false,
  this.initAspectRatio,
  this.rotateAnimationCurve = Curves.decelerate,
  this.scaleAnimationCurve = Curves.decelerate,
  this.cropDragAnimationCurve = Curves.decelerate,
  this.fadeInOutsideCropAreaAnimationCurve = Curves.decelerate,
  this.rotateDirection = RotateDirection.left,
  this.opacityOutsideCropAreaDuration = const Duration(milliseconds: 100),
  this.animationDuration = const Duration(milliseconds: 250),
  this.fadeInOutsideCropAreaAnimationDuration =
      const Duration(milliseconds: 350),
  this.cropDragAnimationDuration = const Duration(milliseconds: 400),
  this.maxScale = 7,
  this.mouseScaleFactor = 0.1,
  this.doubleTapScaleFactor = 2,
  this.aspectRatios = const [
    AspectRatioItem(text: 'Free', value: -1),
    AspectRatioItem(text: 'Original', value: 0.0),
    AspectRatioItem(text: '1*1', value: 1.0 / 1.0),
    AspectRatioItem(text: '4*3', value: 4.0 / 3.0),
    AspectRatioItem(text: '3*4', value: 3.0 / 4.0),
    AspectRatioItem(text: '16*9', value: 16.0 / 9.0),
    AspectRatioItem(text: '9*16', value: 9.0 / 16.0)
  ],
})  : assert(maxScale >= 1, 'maxScale must be greater than or equal to 1'),
      assert(desktopCornerDragArea > 0,
          'desktopCornerDragArea must be positive'),
      assert(!roundCropper || !canChangeAspectRatio,
          'In roundCropper mode, canChangeAspectRatio must be disabled.'),
      assert(!roundCropper || initAspectRatio == 1,
          'In roundCropper mode, initAspectRatio must be 1.'),
      assert(
          mobileCornerDragArea > 0, 'mobileCornerDragArea must be positive'),
      assert(doubleTapScaleFactor > 1,
          'doubleTapScaleFactor must be greater than 1');