process method
- required BuildContext context,
- required CropController controller,
- required File inputFile,
- required int inputFullWidth,
- required int inputFullHeight,
- required File preCroppedFile,
- required Directory directory,
- required int sequenceNumber,
- required List<
Offset> offsets,
override
Processes the crop operation.
Implementation
@override
Future<CropParameters> process({
required BuildContext context,
required CropController controller,
required File inputFile,
required int inputFullWidth,
required int inputFullHeight,
required File preCroppedFile,
required Directory directory,
required int sequenceNumber,
required List<Offset> offsets,
}) async {
// in this case, it's an existing picture, with crop parameters.
// we let the server do everything: better performance, and no privacy
// issue here (we're cropping from an allegedly already privacy compliant
// picture).
final Rect cropRect = _getServerCropRect(
controller,
inputFullWidth,
inputFullHeight,
);
await BackgroundTaskCrop.addTask(
barcode,
productType: productType,
language: language,
imageField: imageField,
imageId: imageId,
croppedFile: preCroppedFile,
rotation: controller.rotation.degrees,
x1: cropRect.left.ceil(),
y1: cropRect.top.ceil(),
x2: cropRect.right.floor(),
y2: cropRect.bottom.floor(),
context: context,
);
if (context.mounted) {
await refresh(context);
}
return CropParameters.withoutFullFile(
preCroppedFile: preCroppedFile,
rotation: controller.rotation.degrees,
cropRect: getLocalCropRect(controller),
);
}