CropOptions class
Configuration options for the interactive image cropper.
Constructors
-
CropOptions({CropAspectRatio? aspectRatio, CropAspectRatio? aspectRatioPreset, List<
CropAspectRatio> availableAspectRatios = CropAspectRatio.defaultPresets, CropShape shape = CropShape.rectangle, bool lockAspectRatio = false, bool allowRotation = true, bool allowFlipping = true, int initialRotation = 0, String? title = 'Crop & Edit', Color? toolbarColor, Color? activeHandleColor, Color? gridColor, Color? overlayColor, Color? cropFrameColor, Color? backgroundColor, bool showGrid = true, bool showReset = true, bool showAspectRatios = true, bool showRotate = true, bool showFlip = true, String doneButtonText = 'Done', String cancelButtonText = 'Cancel', String resetButtonText = 'Reset'}) -
Creates a new CropOptions configuration instance.
const
- CropOptions.circle({String title = 'Crop Profile Photo', Color? activeHandleColor, Color? overlayColor, bool showGrid = true})
-
Creates a circular profile avatar crop option preset.
factory
- CropOptions.square({String title = 'Crop Square', bool lockAspectRatio = true})
-
Creates a square crop option preset.
factory
Properties
- activeHandleColor → Color?
-
Color of the active crop handles and frame.
final
- allowFlipping → bool
-
If true, flip horizontal/vertical controls are enabled.
final
- allowRotation → bool
-
If true, rotation controls are enabled.
final
- aspectRatio → CropAspectRatio?
-
Pre-selected aspect ratio for cropping.
final
- aspectRatioPreset → CropAspectRatio?
-
Alias for aspectRatio.
no setter
-
availableAspectRatios
→ List<
CropAspectRatio> -
List of aspect ratio presets available to choose in the UI.
final
- backgroundColor → Color?
-
Background color of the crop workspace.
final
- cancelButtonText → String
-
Text for the "Cancel" button.
final
- cropFrameColor → Color?
-
Color of the crop frame border.
final
- doneButtonText → String
-
Text for the "Done" confirmation button.
final
- gridColor → Color?
-
Color of the rule-of-thirds grid lines.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialRotation → int
-
Initial rotation angle in degrees (0, 90, 180, 270).
final
- lockAspectRatio → bool
-
If true, the aspect ratio is locked and cannot be changed or resized freely.
final
- overlayColor → Color?
-
Color of the dimmed overlay outside the crop box.
final
- resetButtonText → String
-
Text for the "Reset" button.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → CropShape
-
The crop shape: CropShape.rectangle or CropShape.circle.
final
- showAspectRatios → bool
-
Whether to display the aspect ratio selection bar.
final
- showFlip → bool
-
Whether to display the flip buttons.
final
- showGrid → bool
-
Whether to display the 3x3 grid lines inside the crop frame.
final
- showReset → bool
-
Whether to display the reset button.
final
- showRotate → bool
-
Whether to display the rotate button.
final
- title → String?
-
Title displayed in the cropper top bar.
final
- toolbarColor → Color?
-
Color of the toolbar/app bar.
final
Methods
-
copyWith(
{CropAspectRatio? aspectRatio, List< CropAspectRatio> ? availableAspectRatios, CropShape? shape, bool? lockAspectRatio, bool? allowRotation, bool? allowFlipping, int? initialRotation, String? title, Color? toolbarColor, Color? activeHandleColor, Color? gridColor, Color? overlayColor, Color? cropFrameColor, Color? backgroundColor, bool? showGrid, bool? showReset, bool? showAspectRatios, bool? showRotate, bool? showFlip, String? doneButtonText, String? cancelButtonText, String? resetButtonText}) → CropOptions - Creates a copy of this CropOptions with specified properties updated.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited