@@ -116,66 +116,57 @@ const htmlData = """
116116 <h3>Audio support:</h3>
117117 <h3>IFrame support:</h3>
118118
119-
120119""" ;
121120
122121class _MyHomePageState extends State <MyHomePage > {
123122 @override
124123 Widget build (BuildContext context) {
125124 return new Scaffold (
126125 appBar: AppBar (title: Text ('flutter_html Example' )),
127- body: SafeArea (
128- child: Row (
129- children: < Widget > [
130- Expanded (
131- child: SingleChildScrollView (
132- child: Html (
133- data: htmlData,
134- //Optional parameters:
135- style: {
136- "html" : Style (
137- backgroundColor: Colors .black,
138- color: Colors .white,
139- ),
140- "table" : Style (
141- backgroundColor: Color .fromARGB (0x50 , 0xee , 0xee , 0xee ),
142- ),
143- "tr" : Style (
144- border: Border (bottom: BorderSide (color: Colors .grey)),
145- ),
146- "th" : Style (
147- padding: EdgeInsets .all (6 ),
148- backgroundColor: Colors .grey,
149- ),
150- "td" : Style (
151- padding: EdgeInsets .all (6 ),
152- ),
153- "var" : Style (fontFamily: 'serif' ),
154- },
155- customRender: {
156- "flutter" : (RenderContext context, Widget child, attributes) {
157- return FlutterLogo (
158- style: (attributes['horizontal' ] != null )
159- ? FlutterLogoStyle .horizontal
160- : FlutterLogoStyle .markOnly,
161- textColor: context.style.color,
162- size: context.style.fontSize.size * 5 ,
163- );
164- }
165- },
166- onLinkTap: (url) {
167- print ("Opening $url ..." );
168- },
169- onImageTap: (src) {
170- print (src);
171- },
172- onImageError: (exception, stackTrace) {
173- print (exception);
174- },
175- ),
176- ),
126+ body: SingleChildScrollView (
127+ child: Html (
128+ data: htmlData,
129+ //Optional parameters:
130+ style: {
131+ "html" : Style (
132+ backgroundColor: Colors .black,
133+ color: Colors .white,
134+ ),
135+ "table" : Style (
136+ backgroundColor: Color .fromARGB (0x50 , 0xee , 0xee , 0xee ),
137+ ),
138+ "tr" : Style (
139+ border: Border (bottom: BorderSide (color: Colors .grey)),
140+ ),
141+ "th" : Style (
142+ padding: EdgeInsets .all (6 ),
143+ backgroundColor: Colors .grey,
144+ ),
145+ "td" : Style (
146+ padding: EdgeInsets .all (6 ),
177147 ),
178- ],
148+ "var" : Style (fontFamily: 'serif' ),
149+ },
150+ customRender: {
151+ "flutter" : (RenderContext context, Widget child, attributes, _) {
152+ return FlutterLogo (
153+ style: (attributes['horizontal' ] != null )
154+ ? FlutterLogoStyle .horizontal
155+ : FlutterLogoStyle .markOnly,
156+ textColor: context.style.color,
157+ size: context.style.fontSize.size * 5 ,
158+ );
159+ },
160+ },
161+ onLinkTap: (url) {
162+ print ("Opening $url ..." );
163+ },
164+ onImageTap: (src) {
165+ print (src);
166+ },
167+ onImageError: (exception, stackTrace) {
168+ print (exception);
169+ },
179170 ),
180171 ),
181172 );
0 commit comments