InAppCropper class
A widget that allows cropping and extracting regions of an image interactively.
Use InAppCropper to display an image with interactive cropping functionality.
It supports both local image files and network images.
The cropping behavior can be customized by specifying various parameters such as drag item size, border decoration, rotation, and more.
Basic Usage:
InAppCropper(
imageFile: File('path_to_image.jpg'),
imageWidth: 300,
imageHeight: 400,
onExtractedImage: (croppedImageFile) {
// Handle the extracted image file
},
canCropImage: true,
);
The onExtractedImage callback is triggered when the user extracts a cropped
region of the image. You can use this callback to save or process the cropped image.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- InAppCropper
Constructors
-
InAppCropper({Key? key, required ValueChanged<
File> onExtractedImage, required double imageHeight, required double imageWidth, double dragItemSize = 50.0, String? networkImage, BoxFit? fit, File? imageFile, bool canCropImage = false, BoxBorder? cropBorderDecoration, Widget? increaseWidget, Widget? decreaseWidget, Image? placeHolderImage, int? rotationDuration, Widget? title, BoxDecoration? imageDecoration, double step = 10, Color? sliderActiveColor, Color? sliderInactiveColor, Color? sliderThumbColor, bool canRotate = true, Widget? extractWidget}) - Constructs an InAppCropper widget.
Properties
- canCropImage → bool
-
Determines if the image can be cropped within the cropper.
final
- canRotate → bool
-
Determines if the image can be rotated within the cropper.
final
- cropBorderDecoration → BoxBorder?
-
Decoration for the border around the draggable crop item.
final
- decreaseWidget → Widget?
-
Widget to display for decreasing the drag item size.
final
- dragItemSize ↔ double
-
The initial size of the drag item for cropping.
getter/setter pair
- extractWidget → Widget?
-
Widget to display the button to extract the image after cropping
final
- fit → BoxFit?
-
How the image should be inscribed into the space allocated for it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageDecoration → BoxDecoration?
-
Decoration for the image container.
final
- imageFile → File?
-
The local image file to be displayed in the cropper.
final
- imageHeight → double
-
The height of the image container.
final
- imageWidth → double
-
The width of the image container.
final
- increaseWidget → Widget?
-
Widget to display for increasing the drag item size.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- networkImage → String?
-
The network image URL to be displayed in the cropper.
final
-
onExtractedImage
→ ValueChanged<
File> -
Callback function triggered when an image region is extracted.
final
- placeHolderImage → Image?
-
Placeholder image to display while loading or when no image is available.
final
- rotationDuration → int?
-
The duration for rotation animations in milliseconds.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sliderActiveColor → Color?
-
The color of the active slider track.
final
- sliderInactiveColor → Color?
-
The color of the inactive slider track.
final
- sliderThumbColor → Color?
-
The color of the slider thumb.
final
- step → double
-
The step value used for increasing or decreasing the drag item size.
final
- title → Widget?
-
Widget to display as a title above the crop controls.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< InAppCropper> -
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