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

Image is not displayed when reselecting previously cropped image #85

Open
sonlam103 opened this issue Nov 22, 2021 · 9 comments
Open

Image is not displayed when reselecting previously cropped image #85

sonlam103 opened this issue Nov 22, 2021 · 9 comments

Comments

@sonlam103
Copy link

Hi,
I use your lib for crop image, but I encountering an error, which image is not displayed when reselecting previously cropped image.
I pass an image file to image crop screen, then I crop it, after I reselect it (origin image) from the gallery, then it do not display on screen.
Step:

  1. Select an image from the gallery.
  2. Cover to file, pass it to crop screen.
  3. Crop it, and back to before screen.
  4. Select previously an image from the gallery.
  5. Cover to file, pass it to crop screen ==> image do not display (I attach file).

Screenshot_20211122-114427.

And this is my code for crop image screen (I modified from your example)
https://drive.google.com/file/d/16i3bn5xUELg23mw3UOCOqdN88JHaHOb8/view?usp=sharing

Anyone helps, thanks!

@guilhermedaldim
Copy link

Same issue here!

@mori-heidari
Copy link

I have same issue

@Niko-by
Copy link

Niko-by commented Dec 6, 2021

Same issue here!

@Niko-by
Copy link

Niko-by commented Dec 6, 2021

I think the problem is in the file_picker plugin. I tried to get the file via image_picker and the problem went away.

XFile file = await ImagePicker().pickImage(source: ImageSource.gallery);

@l-7-l
Copy link

l-7-l commented Mar 10, 2022

Try image.evict()

@mariusbloemhof
Copy link

Same issue here!

@fn-19
Copy link

fn-19 commented Oct 6, 2022

Try image.evict()

I have same issue, I use photo_manager library

with this code, sloved problem

in crop file, in didChangeDependencies() and didUpdateWidget() add this line.

thanks

@l-7-l
Copy link

l-7-l commented Mar 13, 2023

Try image.evict()

I have same issue, I use photo_manager library

with this code, sloved problem

in crop file, in didChangeDependencies() and didUpdateWidget() add this line.

thanks

Interestingly, if you call widget.image.obtainCacheStatus(configuration: configuration),it can also be solved

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();

    // widget.image.evict();
    _getImage(force: true); /// Or other way to point out from didChangeDependencies
  }


  void _getImage({bool force = false}) async {
    final oldImageStream = _imageStream;
    final configuration = createLocalImageConfiguration(context);

    final newImageStream = widget.image.resolve(configuration);

    _imageStream = newImageStream;
    if (force) {
      final status = await widget.image.obtainCacheStatus(configuration: configuration);
      print(status);
    }

   /// other codes ...... 
  

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

8 participants
@mariusbloemhof @sonlam103 @l-7-l @mori-heidari @guilhermedaldim @Niko-by @fn-19 and others