cropImage static method

Future cropImage({
  1. required BuildContext context,
  2. required Uint8List imageBytes,
  3. required dynamic onImageDoneListener(
    1. dynamic
    ),
  4. VoidCallback? onImageStartLoading,
  5. VoidCallback? onImageEndLoading,
  6. CropAspectRatio? selectedImageRatio,
  7. bool visibleOtherAspectRatios = true,
  8. double squareBorderWidth = 2,
  9. List<CropAspectRatio>? customAspectRatios,
  10. Color squareCircleColor = Colors.orange,
  11. double squareCircleSize = 30,
  12. Color defaultTextColor = Colors.black,
  13. Color selectedTextColor = Colors.orange,
  14. Color colorForWhiteSpace = Colors.white,
  15. int encodingQuality = 100,
  16. String? workerPath,
  17. bool isConstrain = true,
  18. bool makeDarkerOutside = true,
  19. EdgeInsets? imageEdgeInsets = const EdgeInsets.all(10),
  20. bool rootNavigator = false,
  21. OutputImageFormat outputImageFormat = OutputImageFormat.jpg,
  22. Key? key,
})

Implementation

static Future<dynamic> cropImage(
    {required BuildContext context,
    required Uint8List imageBytes,
    required Function(dynamic) onImageDoneListener,
    VoidCallback? onImageStartLoading,
    VoidCallback? onImageEndLoading,
    CropAspectRatio? selectedImageRatio,
    bool visibleOtherAspectRatios = true,
    double squareBorderWidth = 2,
    List<CropAspectRatio>? customAspectRatios,
    Color squareCircleColor = Colors.orange,
    double squareCircleSize = 30,
    Color defaultTextColor = Colors.black,
    Color selectedTextColor = Colors.orange,
    Color colorForWhiteSpace = Colors.white,
    int encodingQuality = 100,
    String? workerPath,
    bool isConstrain = true,
    bool makeDarkerOutside = true,
    EdgeInsets? imageEdgeInsets = const EdgeInsets.all(10),
    bool rootNavigator = false,
    OutputImageFormat outputImageFormat = OutputImageFormat.jpg,
    Key? key}) {
  /// Here, we are pushing a image cropping2 screen.
  return Navigator.of(context, rootNavigator: rootNavigator).push(
    MaterialPageRoute(
      builder: (_context) => ImageCroppingScreen(
        _context,
        imageBytes,
        onImageStartLoading,
        onImageEndLoading,
        onImageDoneListener,
        colorForWhiteSpace,
        customAspectRatios: customAspectRatios,
        selectedImageRatio: selectedImageRatio,
        visibleOtherAspectRatios: visibleOtherAspectRatios,
        squareCircleColor: squareCircleColor,
        squareBorderWidth: squareBorderWidth,
        squareCircleSize: squareCircleSize,
        defaultTextColor: defaultTextColor,
        selectedTextColor: selectedTextColor,
        encodingQuality: encodingQuality,
        workerPath: workerPath,
        isConstrain: isConstrain,
        makeDarkerOutside: makeDarkerOutside,
        imageEdgeInsets: imageEdgeInsets,
        outputImageFormat: outputImageFormat,
      ),
    ),
  );
}