Closed glaceon2000 closed 2 years ago
Most images cannot render on web while being rendered normally on mobile Sample code:
import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); static const String _title = 'HTML Code Sample'; @override Widget build(BuildContext context) { return MaterialApp( title: _title, home: Scaffold( appBar: AppBar(title: const Text(_title)), body: const MyStatefulWidget(), ), ); } } class MyStatefulWidget extends StatefulWidget { const MyStatefulWidget({Key? key}) : super(key: key); @override State<MyStatefulWidget> createState() => _MyStatefulWidgetState(); } class _MyStatefulWidgetState extends State<MyStatefulWidget> { @override Widget build(BuildContext context) { const temp = r"""<h3>Network png</h3> <img alt="Why is it no working" src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png">"""; return Center( child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ HtmlWidget(temp), ], ), ), ); } }
Result on web:
Result on mobile:
Please check the browser console. This is most likely a CORS error.
@daohoangson can you use HtmlElementView ?
HtmlElementView
Most images cannot render on web while being rendered normally on mobile Sample code:
Result on web:
Result on mobile: