GnkImageCropWidget class
An image cropper that is customizable. You can rotate, scale and translate either through gestures or a controller
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GnkImageCropWidget
Constructors
- GnkImageCropWidget({required String imagePath, required GnkImageCropController cropController, Color overlayColor = const Color.fromRGBO(0, 0, 0, 0.5), Color backgroundColor = Colors.white, CustomCropShape shape = CustomCropShape.Circle, CustomImageFit imageFit = CustomImageFit.fitCropSpace, double cropPercentage = 0.8, CustomPaint drawPath(Path, {Paint? pathPaint}) = DottedCropPathPainter.drawPath, Paint? pathPaint, bool canRotate = true, bool canScale = true, bool canMove = true, bool clipShapeOnCrop = true, Widget? customProgressIndicator, Ratio? ratio, double borderRadius = 0, Paint? imagePaintDuringCrop, bool forceInsideCropArea = false, Key? key})
- A custom image cropper widget
Properties
- backgroundColor → Color
-
The color behind the cropping area
final
- borderRadius → double
-
The radius for rounded corners of the cropping area (only applicable to rounded rectangle shapes).
final
- canMove → bool
-
Determines whether moving gesture overlay is disabled.
final
- canRotate → bool
-
Whether to allow the image to be rotated.
final
- canScale → bool
-
Determines whether scaling gesture is disabled.
final
- clipShapeOnCrop → bool
-
Whether to clip the area outside of the path when cropping
By default, the value is
true
final - cropController → GnkImageCropController
-
The controller that handles the cropping and
changing of the cropping area
final
- cropPercentage → double
-
The percentage of the available area that is
reserved for the cropping area
final
- customProgressIndicator → Widget?
-
This widget is used to specify a custom progress indicator
final
- drawPath → CustomPaint Function(Path, {Paint? pathPaint})
-
The path drawer of the border see DottedCropPathPainter,
SolidPathPainter
for more details or how to implement a custom onefinal - forceInsideCropArea → bool
-
Whether image area must cover clip path
By default, the value is
false
If use CustomCropShape.circle, the cropped image may have white blank.final - hashCode → int
-
The hash code for this object.
no setterinherited
- imageFit → CustomImageFit
-
How to fit image inside visible space
final
- imagePaintDuringCrop → Paint
-
The paint used when drawing an image before cropping
final
- imagePath → String
-
The image to crop
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- overlayColor → Color
-
The color in front of the cropped area
final
- pathPaint → Paint?
-
Custom paint options for drawing the cropping border.
final
- ratio → Ratio?
-
Ratio of the cropping area.
If shape is set to CustomCropShape.Ratio, this property is required.
For example, to create a square crop area, use Ratio(width: 1, height: 1).
To create a rectangular crop area with a 16:9 aspect ratio, use Ratio(width: 16, height: 9).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → CustomCropShape
-
The shape of the cropping area.
Possible values:
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _GnkImageCropWidgetState -
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, int wrapWidth = 65}) → 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