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

Inconsistent image display when Cropping on Web #525

Open
ramluro1 opened this issue Aug 28, 2024 · 0 comments
Open

Inconsistent image display when Cropping on Web #525

ramluro1 opened this issue Aug 28, 2024 · 0 comments

Comments

@ramluro1
Copy link

ramluro1 commented Aug 28, 2024

I am in the process of developing a Web app using Flutter, and I am currently using version 4.0.1 of the flutter_image_cropper package.

I cannot upgrade to a newer version due to other dependencies (HTTP package).

When I invoke cropping, the image is being displayed inconsistently. I expect the full image to be displayed, but on occasion, it is zoomed in.
Full image
image

Zoomed-in image
image

How do I avoid this inconsistent behavior?

Here is the code that is calling the Crop function:

  Future<CroppedFile?> _cropProfileImage({required String imageUrl}) async {
    const height = 350;
    const width = 350;

    if (imageUrl != '') {
      final croppedFile = await ImageCropper().cropImage(
        sourcePath: _imageUrl,
        compressFormat: ImageCompressFormat.jpg,
        compressQuality: 100,
        uiSettings: [
          WebUiSettings(
            context: context,
            presentStyle: CropperPresentStyle.dialog,
            boundary: CroppieBoundary(width: width, height: width),
            viewPort: const CroppieViewPort(
                width: width - 20, height: height - 20, type: 'square'),
            enableExif: true,
            enableZoom: true,
            showZoomer: true,
          ),
        ],
      );
      if (croppedFile != null) {
        return croppedFile;
      }
    } else {
      return null;
    }
    return null;
  }

@ramluro1 ramluro1 changed the title Inconsistent image display when Cropping Inconsistent image display when Cropping on Web Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant