Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] progressIndicator not working #141

Open
c-seeger opened this issue Feb 19, 2024 · 3 comments
Open

[web] progressIndicator not working #141

c-seeger opened this issue Feb 19, 2024 · 3 comments
Assignees
Labels
need fix Issues that @chooyan-eng need to do something

Comments

@c-seeger
Copy link

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

@chooyan-eng
Copy link
Owner

@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.
  }
}

@chooyan-eng chooyan-eng added the need fix Issues that @chooyan-eng need to do something label Feb 20, 2024
@chooyan-eng chooyan-eng self-assigned this Feb 20, 2024
@adamazlo
Copy link

adamazlo commented Mar 7, 2024

Just wanna +1 this, with larger files the UI just seems to freeze completely when cropping. Otherwise, great work with this package!

@andre-ab
Copy link

@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 imageCropperparâ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'. ????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need fix Issues that @chooyan-eng need to do something
Projects
None yet
Development

No branches or pull requests

4 participants