flutter_widget_from_html icon indicating copy to clipboard operation
flutter_widget_from_html copied to clipboard

SVG images not rendering if src URL has no .svg extension

Open mplgn opened this issue 1 year ago • 1 comments

Thanks for this awesome package!

Images stored in my CMS (ButterCMS) have urls without the image type file extension (e.g., no ".png", ".svg") in the src URL.

  • This works fine for all image types except svg.
  • When an svg image is given as the src, the alt text is rendered instead of the svg image
  • An image url with the .svg extension does render correctly (unfortunately not an option for me because of the CMS)

Steps to Reproduce

HTML
<img src="https://cdn.buttercms.com/gGgFu5YTmWA3vwTcJGSM" alt="SVG Image">
`HtmlWidget` configuration
HtmlWidget(
      '<img src="https://cdn.buttercms.com/gGgFu5YTmWA3vwTcJGSM" alt="SVG Image">',
)
Tesing environment
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.4)
[✓] VS Code (version 1.91.1)
[✓] Connected device (6 available)
[✓] Network resources

• No issues found!

Expected results

image

Actual results

image

mplgn avatar Aug 02 '24 00:08 mplgn

Yes, this is a limitation of the IMG handling logic. It depends on the extension to switch between built-in Flutter rendering and SVG rendering.

daohoangson avatar Aug 08 '24 01:08 daohoangson