Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## 12.0.3
- **FEAT**(crop-rotate-editor): Add `exportOvalMask` to `CropRotateEditorConfigs` (default `true`). When set to `false`, the exported image uses a plain rectangular crop even if `CropMode.oval` is active, while the oval UI remains visible inside the crop editor.
- **FEAT**(crop-rotate-editor): Add `helperLineWidth` to `CropRotateEditorStyle`, allowing the grid line thickness to be customized or hidden entirely by setting it to `0`.

## 12.0.2
Expand Down
11 changes: 11 additions & 0 deletions lib/core/models/editor_configs/crop_rotate_editor_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs {
this.invertMouseScroll = false,
this.invertDragDirection = false,
this.initialCropMode = CropMode.rectangular,
this.exportOvalMask = true,
this.enableTransformLayers = true,
this.enableProvideImageInfos = false,
this.enableDoubleTap = true,
Expand Down Expand Up @@ -132,6 +133,14 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs {
/// presented to the user before any manual adjustments are made.
final CropMode initialCropMode;

/// Controls whether the oval mask is applied to the exported image when
/// [initialCropMode] is set to [CropMode.oval].
///
/// When `true` (default), the exported image is clipped to an oval/circle
/// shape. When `false`, the raw rectangular crop is exported without any
/// oval masking, while the oval UI is still shown inside the crop editor.
final bool exportOvalMask;

/// Defines which crop-rotate tools are available in the editor.
///
/// The order of the tools in this list determines the order in the UI.
Expand Down Expand Up @@ -259,6 +268,7 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs {
bool? invertMouseScroll,
bool? invertDragDirection,
CropMode? initialCropMode,
bool? exportOvalMask,
List<CropRotateTool>? tools,
bool? enableProvideImageInfos,
double? initAspectRatio,
Expand Down Expand Up @@ -294,6 +304,7 @@ class CropRotateEditorConfigs implements BaseSubEditorConfigs {
invertMouseScroll: invertMouseScroll ?? this.invertMouseScroll,
invertDragDirection: invertDragDirection ?? this.invertDragDirection,
initialCropMode: initialCropMode ?? this.initialCropMode,
exportOvalMask: exportOvalMask ?? this.exportOvalMask,
tools: tools ?? this.tools,
enableProvideImageInfos:
enableProvideImageInfos ?? this.enableProvideImageInfos,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,17 @@ class TransformedContentGenerator extends StatelessWidget {

CropMode cropMode = _transformConfigs.cropMode;

final effectiveCropMode =
cropMode == CropMode.oval && !configs.cropRotateEditor.exportOvalMask
? CropMode.rectangular
: cropMode;

final clipper = CutOutsideArea(
configs: _transformConfigs,
cropMode: cropMode,
cropMode: effectiveCropMode,
);

if (cropMode == CropMode.oval) {
if (effectiveCropMode == CropMode.oval) {
return ClipOval(clipper: clipper, child: child);
} else {
return ClipRect(clipper: clipper, child: child);
Expand Down