CropRotateEditorConfigs constructor
const
CropRotateEditorConfigs({
- double desktopCornerDragArea = 7,
- double mobileCornerDragArea = kMinInteractiveDimension,
- bool enabled = true,
- bool canRotate = true,
- bool canFlip = true,
- bool enableDoubleTap = true,
- bool transformLayers = true,
- bool canChangeAspectRatio = true,
- bool canReset = true,
- bool reverseMouseScroll = false,
- bool reverseDragDirection = false,
- bool roundCropper = false,
- double? initAspectRatio,
- Curve rotateAnimationCurve = Curves.decelerate,
- Curve scaleAnimationCurve = Curves.decelerate,
- Curve cropDragAnimationCurve = Curves.decelerate,
- Curve fadeInOutsideCropAreaAnimationCurve = Curves.decelerate,
- RotateDirection rotateDirection = RotateDirection.left,
- Duration opacityOutsideCropAreaDuration = const Duration(milliseconds: 100),
- Duration animationDuration = const Duration(milliseconds: 250),
- Duration fadeInOutsideCropAreaAnimationDuration = const Duration(milliseconds: 350),
- Duration cropDragAnimationDuration = const Duration(milliseconds: 400),
- double maxScale = 7,
- double mouseScaleFactor = 0.1,
- double doubleTapScaleFactor = 2,
- 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');