@@ -282,25 +282,28 @@ class _CustomImageCropState extends State<CustomImageCrop>
282
282
final pictureRecorder = ui.PictureRecorder ();
283
283
final canvas = Canvas (pictureRecorder);
284
284
final onCropParams = caclulateOnCropParams (
285
- cropPercentage: widget.cropPercentage,
286
- imageFit: widget.imageFit,
287
- imageHeight: imageHeight,
288
- imageWidth: imageWidth,
289
- screenHeight: _height,
290
- screenWidth: _width,
291
- dataScale: data.scale,
285
+ cropPercentage: widget.cropPercentage,
286
+ imageFit: widget.imageFit,
287
+ imageHeight: imageHeight,
288
+ imageWidth: imageWidth,
289
+ screenHeight: _height,
290
+ screenWidth: _width,
291
+ dataScale: data.scale,
292
292
);
293
- final clipPath =
294
- Path . from ( _getPath ( onCropParams.cropSize, onCropParams.cropSize, onCropParams.cropSize));
293
+ final clipPath = Path . from ( _getPath (
294
+ onCropParams.cropSize, onCropParams.cropSize, onCropParams.cropSize));
295
295
final matrix4Image = Matrix4 .diagonal3 (vector_math.Vector3 .all (1 ))
296
- ..translate (onCropParams.translateScale * data.x + onCropParams.cropSize / 2 ,
296
+ ..translate (
297
+ onCropParams.translateScale * data.x + onCropParams.cropSize / 2 ,
297
298
onCropParams.translateScale * data.y + onCropParams.cropSize / 2 )
298
299
..scale (onCropParams.scale)
299
300
..rotateZ (data.angle);
300
301
final bgPaint = Paint ()
301
302
..color = widget.backgroundColor
302
303
..style = PaintingStyle .fill;
303
- canvas.drawRect (Rect .fromLTWH (0 , 0 , onCropParams.cropSize, onCropParams.cropSize), bgPaint);
304
+ canvas.drawRect (
305
+ Rect .fromLTWH (0 , 0 , onCropParams.cropSize, onCropParams.cropSize),
306
+ bgPaint);
304
307
canvas.save ();
305
308
canvas.clipPath (clipPath);
306
309
canvas.transform (matrix4Image.storage);
@@ -314,8 +317,8 @@ class _CustomImageCropState extends State<CustomImageCrop>
314
317
// final bytes = await compute(computeToByteData, <String, dynamic>{'pictureRecorder': pictureRecorder, 'cropWidth': cropWidth});
315
318
316
319
ui.Picture picture = pictureRecorder.endRecording ();
317
- ui.Image image =
318
- await picture. toImage ( onCropParams.cropSize.floor (), onCropParams.cropSize.floor ());
320
+ ui.Image image = await picture. toImage (
321
+ onCropParams.cropSize.floor (), onCropParams.cropSize.floor ());
319
322
320
323
// Adding compute would be preferrable. Unfortunately we cannot pass an ui image to this.
321
324
// A workaround would be to save the image and load it inside of the isolate
0 commit comments