11import 'package:simple_html_css/simple_html_css.dart' ;
22import 'package:flutter/material.dart' ;
33
4- void main () {
5- runApp (Home ());
6- }
4+ void main () => runApp (Home ());
75
86class Home extends StatelessWidget {
97 @override
108 Widget build (BuildContext context) {
11- String htmlContent = """
9+ const String htmlContent = """
1210<body>
1311
1412<h1 style='color: white; font-size:50px; font-style:italic; background-color: rgb(0,122,255); font-weight:100;)'> Hello word! </h1>
@@ -24,17 +22,17 @@ class Home extends StatelessWidget {
2422""" ;
2523
2624 // or use HTML.toRichText()
27- var textSpan = HTML .toTextSpan (
25+ final TextSpan textSpan = HTML .toTextSpan (
2826 context,
2927 htmlContent,
30- linksCallback: (link) {
31- print ( " You clicked on $link " );
28+ linksCallback: (dynamic link) {
29+ debugPrint ( ' You clicked on ${ link . toString ()}' );
3230 },
3331 // as name suggests, optionally set the default text style
3432 defaultTextStyle: TextStyle (color: Colors .grey[700 ]),
35- overrideStyle: {
36- "p" : TextStyle (fontSize: 17.3 ),
37- "a" : TextStyle (wordSpacing: 2 ),
33+ overrideStyle: < String , TextStyle > {
34+ 'p' : const TextStyle (fontSize: 17.3 ),
35+ 'a' : const TextStyle (wordSpacing: 2 ),
3836 // specify any tag not just the supported ones,
3937 // and apply TextStyles to them and/override them
4038 },
@@ -43,7 +41,7 @@ class Home extends StatelessWidget {
4341 return MaterialApp (
4442 debugShowCheckedModeBanner: false ,
4543 home: Scaffold (
46- appBar: AppBar (title: Text (" Demo" )),
44+ appBar: AppBar (title: Text (' Demo' )),
4745 body: Container (
4846 color: Colors .white,
4947 padding: EdgeInsets .all (16.0 ),
0 commit comments