Open c-seeger opened 6 months ago
@c-seeger Thank you for the suggestion. As I'm not very familiar with web, let me take some time to challenge solving this. If you are in a hurry, consider overriding cropping logic with imageCropper
parameter.
Crop(
image: _imageData,
controller: _controller,
imageCropper: YourCustomImageCropper(),
),
class YourCustomImageCropper<Image> extends ImageCropper {
@override
FutureOr<Uint8List> call({
required Image original,
required Offset topLeft,
required Offset bottomRight,
ImageFormat outputFormat = ImageFormat.jpeg,
ImageShape shape = ImageShape.rectangle,
}) {
// call `defaultImageCropper.call()` using some trick not to block during operation.
// return the result of the step above.
}
}
Just wanna +1 this, with larger files the UI just seems to freeze completely when cropping. Otherwise, great work with this package!
@c-seegerObrigado pela sugestão. Como não estou muito familiarizado com a web, deixe-me dedicar algum tempo para desafiar a solução disso. Se você estiver com pressa, considere substituir a lógica de corte pelo
imageCropper
parâmetro.Crop( image: _imageData, controller: _controller, imageCropper: YourCustomImageCropper(), ),
class YourCustomImageCropper<Image> extends ImageCropper { @override FutureOr<Uint8List> call({ required Image original, required Offset topLeft, required Offset bottomRight, ImageFormat outputFormat = ImageFormat.jpeg, ImageShape shape = ImageShape.rectangle, }) { // call `defaultImageCropper.call()` using some trick not to block during operation. // return the result of the step above. } }
Undefined class 'ImageShape'. ????
Since the whole library is not using web worker when starting to crop using
controller.crop()
the cropping blocks the main thread resulting in a frozen page. A side effect of this is that the progressIndicator did also not work on web.maybe sth. like https://pub.dev/packages/squadron could help solving the multithreading problems for web