【发布时间】:2020-04-14 06:42:56
【问题描述】:
我正在使用 flutter_html 来呈现 html 代码,它运行良好,但我遇到了 img 标签的问题
当图片来自网络时,img 标签可以正常工作,如下所示:
<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
但是当它是本地资产图像文件时它不起作用 注意:我可以像这样在 Image 小部件中使用相同的图像:
Image.asset('assets/images/logo_tst.png'),
但它不会显示在 html 代码中,我尝试了所有这些:
String htmlUrl = '''
<img src="file:///storage/assets/images/logo_tst.png" alt="web-img1" >
<img src="file:///assets/images/logo_tst.png" alt="web-img2">
<img src="file:///images/logo_tst.png" alt="web-img3">
''';
那我叫它:
Html( data:htmlUrl),
而且它只显示alt:
web-img1
web-img2
web-img3
我正在 Android 模拟器和设备上进行测试
我做错了什么?
谢谢
【问题讨论】:
标签: html image flutter dart assets