@@ -12,12 +12,14 @@ import 'package:webview_flutter/webview_flutter.dart';
12
12
//export render context api
13
13
export 'package:flutter_html/html_parser.dart' ;
14
14
export 'package:flutter_html/image_render.dart' ;
15
+
15
16
//export src for advanced custom render uses (e.g. casting context.tree)
16
17
export 'package:flutter_html/src/anchor.dart' ;
17
18
export 'package:flutter_html/src/interactable_element.dart' ;
18
19
export 'package:flutter_html/src/layout_element.dart' ;
19
20
export 'package:flutter_html/src/replaced_element.dart' ;
20
21
export 'package:flutter_html/src/styled_element.dart' ;
22
+
21
23
//export style api
22
24
export 'package:flutter_html/style.dart' ;
23
25
@@ -95,8 +97,8 @@ class Html extends StatelessWidget {
95
97
/// The HTML data passed to the widget as a String
96
98
final String ? data;
97
99
98
- /// The HTML data passed to the widget as a pre-processed [dom.Document ]
99
- final dom.Document ? document;
100
+ /// The HTML data passed to the widget as a pre-processed [dom.Element ]
101
+ final dom.Element ? document;
100
102
101
103
/// A function that defines what to do when a link is tapped
102
104
final OnTap ? onLinkTap;
@@ -150,8 +152,7 @@ class Html extends StatelessWidget {
150
152
151
153
@override
152
154
Widget build (BuildContext context) {
153
- final dom.Document doc =
154
- data != null ? HtmlParser .parseHTML (data! ) : document! ;
155
+ final dom.Element doc = data != null ? HtmlParser .parseHTML (data! ): document! ;
155
156
final double ? width = shrinkWrap ? null : MediaQuery .of (context).size.width;
156
157
157
158
return Container (
@@ -169,9 +170,7 @@ class Html extends StatelessWidget {
169
170
selectable: false ,
170
171
style: style,
171
172
customRender: customRender,
172
- imageRenders: {}
173
- ..addAll (customImageRenders)
174
- ..addAll (defaultImageRenders),
173
+ imageRenders: {}..addAll (customImageRenders)..addAll (defaultImageRenders),
175
174
tagsList: tagsList.isEmpty ? Html .tags : tagsList,
176
175
navigationDelegateForIframe: navigationDelegateForIframe,
177
176
),
@@ -211,34 +210,34 @@ class SelectableHtml extends StatelessWidget {
211
210
/// (e.g. bold or italic), while container related styling (e.g. borders or padding/margin)
212
211
/// do not work because we can't use the `ContainerSpan` class (it needs an enclosing `WidgetSpan` ).
213
212
214
- SelectableHtml ({
215
- Key ? key,
216
- GlobalKey ? anchorKey,
217
- required this .data,
218
- this .onLinkTap,
219
- this .onAnchorTap,
220
- this .onCssParseError,
221
- this .shrinkWrap = false ,
222
- this .style = const {},
223
- this .tagsList = const [],
224
- this .selectionControls
225
- }) : document = null ,
213
+ SelectableHtml (
214
+ { Key ? key,
215
+ GlobalKey ? anchorKey,
216
+ required this .data,
217
+ this .onLinkTap,
218
+ this .onAnchorTap,
219
+ this .onCssParseError,
220
+ this .shrinkWrap = false ,
221
+ this .style = const {},
222
+ this .tagsList = const [],
223
+ this .selectionControls})
224
+ : document = null ,
226
225
assert (data != null ),
227
226
_anchorKey = anchorKey ?? GlobalKey (),
228
227
super (key: key);
229
228
230
- SelectableHtml .fromDom ({
231
- Key ? key,
232
- GlobalKey ? anchorKey,
233
- required this .document,
234
- this .onLinkTap,
235
- this .onAnchorTap,
236
- this .onCssParseError,
237
- this .shrinkWrap = false ,
238
- this .style = const {},
239
- this .tagsList = const [],
240
- this .selectionControls
241
- }) : data = null ,
229
+ SelectableHtml .fromDom (
230
+ { Key ? key,
231
+ GlobalKey ? anchorKey,
232
+ required this .document,
233
+ this .onLinkTap,
234
+ this .onAnchorTap,
235
+ this .onCssParseError,
236
+ this .shrinkWrap = false ,
237
+ this .style = const {},
238
+ this .tagsList = const [],
239
+ this .selectionControls})
240
+ : data = null ,
242
241
assert (document != null ),
243
242
_anchorKey = anchorKey ?? GlobalKey (),
244
243
super (key: key);
@@ -249,8 +248,8 @@ class SelectableHtml extends StatelessWidget {
249
248
/// The HTML data passed to the widget as a String
250
249
final String ? data;
251
250
252
- /// The HTML data passed to the widget as a pre-processed [dom.Document ]
253
- final dom.Document ? document;
251
+ /// The HTML data passed to the widget as a pre-processed [dom.Element ]
252
+ final dom.Element ? document;
254
253
255
254
/// A function that defines what to do when a link is tapped
256
255
final OnTap ? onLinkTap;
@@ -280,7 +279,7 @@ class SelectableHtml extends StatelessWidget {
280
279
281
280
@override
282
281
Widget build (BuildContext context) {
283
- final dom.Document doc = data != null ? HtmlParser .parseHTML (data! ) : document! ;
282
+ final dom.Element doc = data != null ? HtmlParser .parseHTML (data! ) : document! ;
284
283
final double ? width = shrinkWrap ? null : MediaQuery .of (context).size.width;
285
284
286
285
return Container (
0 commit comments