Cropper class

Inheritance

Constructors

Cropper({Key? key, Color backgroundColor = const Color(0xFFCECECE), Color overlayColor = Colors.black38, OverlayType overlayType = OverlayType.none, double zoomScale = 2.5, double gridLineThickness = 2.0, double aspectRatio = 1, int rotationTurns = 0, GestureScaleStartCallback? onScaleStart, GestureScaleUpdateCallback? onScaleUpdate, GestureScaleEndCallback? onScaleEnd, required GlobalKey<State<StatefulWidget>>? cropperKey, required Image image})
const

Properties

aspectRatio double
The aspect ratio to crop the image to. Defaults to a square (an aspect ratio of 1.0)
final
backgroundColor Color
The background color of the cropper widget, visible when the image won't fill the entire widget. Defaults to a light grey color: Color(0xFFCECECE).
final
cropperKey GlobalKey<State<StatefulWidget>>?
The cropper's key to reference when calling the crop function.
final
gridLineThickness double
The thickness of the grid lines. Defaults to 2.0.
final
hashCode int
The hash code for this object.
no setterinherited
image Image
The image to crop.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onScaleEnd GestureScaleEndCallback?
The called when scale end.
final
onScaleStart GestureScaleStartCallback?
The called when scale start.
final
onScaleUpdate GestureScaleUpdateCallback?
The called when scale update.
final
overlayColor Color
The color of the cropper's overlay. Defaults to semi-transparent black Colors.black54
final
overlayType OverlayType
The type of semi-transparent overlay. Can either be an OverlayType.circle or OverlayType.none to hide the overlay. Defaults to none so no overlay is shown by default.
final
rotationTurns int
The number of clockwise quarter turns the image should be rotated. Defaults to 0.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
zoomScale double
The maximum scale the user is able to zoom. Defaults to 2.5
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<Cropper>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

crop({required GlobalKey<State<StatefulWidget>> cropperKey, double pixelRatio = 3}) Future<Uint8List?>
Crops the image as displayed in the cropper widget, converts it to PNG format and returns it as Uint8List. The cropper widget should be referenced using its key.