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

Offline support for images #172

Closed
LeeMatthewHiggins opened this issue Oct 10, 2019 · 5 comments
Closed

Offline support for images #172

LeeMatthewHiggins opened this issue Oct 10, 2019 · 5 comments

Comments

@LeeMatthewHiggins
Copy link

I have an application who's user base has patchy internet. The application has a download sync function for offline use. At the moment the RichTextParser uses a standard network image, and so will not work offline. I am using cachedNetworkImage in other places in my application to allow offline images. I have tried using the custom render function, however this does not work when using the rich text parser, which I need for the application.

I first added the CachedNetworkImage widget in place of the NetworkImage, this worked well, but added a dependency of the flutter_cache lib. I have refactored to simply expose a custom render function specifically for the image tag. This makes adding a customer image renderer very simple and adds no extra dependencies to flutter_html.

I have a branch with the changes.

@kheniparth
Copy link

Could you please tell me where is this branch that you have mentioned? I can see only one "new-parser" branch in this repository.

@LeeMatthewHiggins
Copy link
Author

I had to fork to be able to proceed with my project: See here:
https://github.com/farmsmart/flutter_html/tree/feature/customImgRender
the interface needs a peer review. (happy to work on that with you if needed)
My aim was not to expose the details of the parsing (dom) to the custom image render function (like the current custom function does), this way if you ever change the html parser the api will not change, plus the external developer never need to worry about the details of the dom etc..

Its working correctly in my application,
See this branch for a working example swapping out the original image for a caching network image. https://github.com/farmsmart/farmsmart-flutter/tree/bugfix/FARM-499-images-not-working-offline

@kheniparth
Copy link

Thank you for the information, and sorry for late reply, I got distracted by other things :-D .
I will try the branch you have mentioned once I get some time.

@maheshbhattaraai
Copy link

@LeeMatthewHiggins this supports cached image network?? Do you have demo example.

@erickok
Copy link
Collaborator

erickok commented Feb 8, 2021

Duplicate of #478 which would use local relative paths; or you could write a custom image render (when #505 is merged).

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

4 participants