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

Doesn't work for this url (base64 image) #17

Closed
pdivita opened this issue Jan 24, 2022 · 2 comments
Closed

Doesn't work for this url (base64 image) #17

pdivita opened this issue Jan 24, 2022 · 2 comments

Comments

@pdivita
Copy link

pdivita commented Jan 24, 2022

This is the url I tested: http://www.phoenicia.it/

I don't know if this is a problem of how the webpage is coded, but link_view_vertical.dart tries always to use NetworkImage, but in this case the imageUri parameter is not an uri, but a data:image in base64 format as String.

I added a momentary fix. Instad of

image: DecorationImage(image: NetworkImage(imageUri), fit: BoxFit.cover)

I changed it to:
image: DecorationImage(image: img, fit: BoxFit.fitWidth,)

where img definition is this:

ImageProvider img = NetworkImage(imageUri);
if(imageUri.startsWith('data:image')){
   img = MemoryImage(base64Decode(imageUri.substring(imageUri.indexOf('base64') + 7)));
}

Hope it helps.

Added screenshot of the code
immagine

@sur950
Copy link
Owner

sur950 commented Jan 25, 2022

Hi @pdivita

Thanks for using the package & letting us know on a fix which works one more use case.
I will add this change in the next release.

Do share & give a star to the repo if you like it.

@sur950
Copy link
Owner

sur950 commented Jan 25, 2022

Added in version 2.0.3

@sur950 sur950 closed this as completed Jan 25, 2022
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

2 participants