icapps/flutter-custom-image-crop

CustomCropShape - Ratio

nicmohr25 opened this issue · 1 comments

Is it possible to include a feature to use a ratio instead of the CustomCropShape? I'd need to be able to crop rectangles in custom ratios. If this package would support something like this, it would really be perfect.

Thanks

Hi @nicmohr25, sorry for the late response. We currently don't support this, however the code is setup that this should be easily implementable.
You could do two things, either add a new custom shape ratio and add parameters to define the ratio. Or add a parameter for any path. Currently it is implemented that the shape defines the path like this:

case CustomCropShape.Square:
    return Path()
      ..addRect(
        Rect.fromCenter(
          center: Offset(width / 2, height / 2),
          width: cropWidth,
          height: cropWidth,
        ),
      );

So you can easily extend this functionality. Feel free to create a PR! (I currently don't have the resources to add this unfortunately)