我使用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
我正在模拟器和设备上进行测试,有哪些做法是不正确的?
谢谢您