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

Recreating thumbnail with new image #1

Open
carekb684 opened this issue Oct 7, 2020 · 3 comments
Open

Recreating thumbnail with new image #1

carekb684 opened this issue Oct 7, 2020 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@carekb684
Copy link

Hello!

Thanks for this plugin.

I seem to be having a problem, here is the workflow:

1.Thumbnail gets created with "_image":
Thumbnail(
dataResolver: () async {
return _image.readAsBytes();
},
mimeType: "image/" + _image.extension,
widgetSize: double.infinity,
)

  1. _image is changed to another image and setState is called and the thumbnail should be recreated.

I have a breakpoint when debugging on the line "return _image.readAsBytes();" and it is run on step 1, but after setState is called the thumbnail code is rerun, but never the line "return _image.readAsBytes();" and consequently, the image is not updated.

Perhaps i am missing something and there is no issue with the plugin.

Help appreciated.

@MartinHlavna
Copy link
Member

Hello,

this is currently not supported for performance reasons.

One possible workound would be to provide widget with Key and change it after changing the _image variable. This way it should force flutter to recreate the widget state and load new thumbnail.

We have no plans to add support for updating the thumbnail at the moment but we would be happy to merge well written PR.

@MartinHlavna MartinHlavna added the enhancement New feature or request label Feb 23, 2021
@ethael ethael added the help wanted Extra attention is needed label May 17, 2022
@doruchidean
Copy link

@carekb684 did u try imageCache.clear(); just before showing the new image?

@dharambudh1
Copy link

dharambudh1 commented Jun 13, 2023

I can understand your concern, you're facing thumbnail re-rendering issue. So, this is my code & it is working as expected. I solved it by providing a "Key" with value of it's path. If in-case it won't work for you try - key: UniqueKey(), at line no. 211.

alt text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants