daohoangson / flutter_widget_from_html

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.
https://pub.dev/packages/flutter_widget_from_html
MIT License
645 stars 242 forks source link

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

Open mplgn opened 3 months ago

mplgn commented 3 months ago

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.

Steps to Reproduce

HTML ```html SVG Image ```
`HtmlWidget` configuration ```dart HtmlWidget( '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
daohoangson commented 3 months ago

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.