@@ -74,7 +74,7 @@ const htmlData = r"""
7474 <td rowspan='2'>Rowspan\nRowspan\nRowspan\nRowspan\nRowspan\nRowspan\nRowspan\nRowspan\nRowspan\nRowspan</td><td>Data</td><td>Data</td>
7575 </tr>
7676 <tr>
77- <td colspan="2"><img alt='Google' src='https://hdwallsource. com/img/2014/7/large-40566-41516-hd-wallpapers.jpg ' /></td>
77+ <td colspan="2"><img alt='Google' src='https://www.google. com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png ' /></td>
7878 </tr>
7979 </tbody>
8080 <tfoot>
@@ -122,7 +122,7 @@ const htmlData = r"""
122122 </p>
123123 <h3>Image support:</h3>
124124 <h3>Network png</h3>
125- <img alt='Google' src='https://hdwallsource. com/img/2014/7/large-40566-41516-hd-wallpapers.jpg ' />
125+ <img alt='Google' src='https://www.google. com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png ' />
126126 <h3>Network svg</h3>
127127 <img src='https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg' />
128128 <h3>Local asset png</h3>
@@ -247,9 +247,8 @@ class _MyHomePageState extends State<MyHomePage> {
247247 title: Text ('flutter_html Example' ),
248248 centerTitle: true ,
249249 ),
250- body: ListView .builder (
251- itemCount: 5 ,
252- itemBuilder: (context, index) => Html (
250+ body: SingleChildScrollView (
251+ child: Html (
253252 data: htmlData,
254253 tagsList: Html .tags..addAll (["bird" , "flutter" ]),
255254 style: {
@@ -268,13 +267,17 @@ class _MyHomePageState extends State<MyHomePage> {
268267 alignment: Alignment .topLeft,
269268 ),
270269 'h5' : Style (maxLines: 2 , textOverflow: TextOverflow .ellipsis),
270+ 'iframe' : Style (
271+ display: Display .BLOCK ,
272+ padding: const EdgeInsets .symmetric (horizontal: 16.0 ),
273+ ),
271274 },
272275 customRender: {
273276 "table" : (context, child) {
274277 return SingleChildScrollView (
275278 scrollDirection: Axis .horizontal,
276279 child:
277- (context.tree as TableLayoutElement ).toWidget (context),
280+ (context.tree as TableLayoutElement ).toWidget (context),
278281 );
279282 },
280283 "bird" : (RenderContext context, Widget child) {
@@ -296,19 +299,19 @@ class _MyHomePageState extends State<MyHomePage> {
296299 return FlutterLogo (size: 36 );
297300 },
298301 networkSourceMatcher (domains: ["mydomain.com" ]):
299- networkImageRender (
302+ networkImageRender (
300303 headers: {"Custom-Header" : "some-value" },
301304 altWidget: (alt) => Text (alt ?? "" ),
302305 loadingWidget: () => Text ("Loading..." ),
303306 ),
304307 // On relative paths starting with /wiki, prefix with a base url
305- (attr, _) =>
306- attr["src" ] != null && attr["src" ]! .startsWith ("/wiki" ):
307- networkImageRender (
308- mapUrl: (url) => "https://upload.wikimedia.org" + url! ),
308+ (attr, _) =>
309+ attr["src" ] != null && attr["src" ]! .startsWith ("/wiki" ):
310+ networkImageRender (
311+ mapUrl: (url) => "https://upload.wikimedia.org" + url! ),
309312 // Custom placeholder image for broken links
310313 networkSourceMatcher ():
311- networkImageRender (altWidget: (_) => FlutterLogo ()),
314+ networkImageRender (altWidget: (_) => FlutterLogo ()),
312315 },
313316 onLinkTap: (url, _, __, ___) {
314317 print ("Opening $url ..." );
@@ -327,7 +330,7 @@ class _MyHomePageState extends State<MyHomePage> {
327330 });
328331 },
329332 ),
330- )
333+ ),
331334 );
332335 }
333336}
0 commit comments