@@ -12,12 +12,14 @@ import 'package:webview_flutter/webview_flutter.dart';
1212//export render context api
1313export 'package:flutter_html/html_parser.dart' ;
1414export 'package:flutter_html/image_render.dart' ;
15+
1516//export src for advanced custom render uses (e.g. casting context.tree)
1617export 'package:flutter_html/src/anchor.dart' ;
1718export 'package:flutter_html/src/interactable_element.dart' ;
1819export 'package:flutter_html/src/layout_element.dart' ;
1920export 'package:flutter_html/src/replaced_element.dart' ;
2021export 'package:flutter_html/src/styled_element.dart' ;
22+
2123//export style api
2224export 'package:flutter_html/style.dart' ;
2325
@@ -95,8 +97,8 @@ class Html extends StatelessWidget {
9597 /// The HTML data passed to the widget as a String
9698 final String ? data;
9799
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;
100102
101103 /// A function that defines what to do when a link is tapped
102104 final OnTap ? onLinkTap;
@@ -150,8 +152,7 @@ class Html extends StatelessWidget {
150152
151153 @override
152154 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! ;
155156 final double ? width = shrinkWrap ? null : MediaQuery .of (context).size.width;
156157
157158 return Container (
@@ -169,9 +170,7 @@ class Html extends StatelessWidget {
169170 selectable: false ,
170171 style: style,
171172 customRender: customRender,
172- imageRenders: {}
173- ..addAll (customImageRenders)
174- ..addAll (defaultImageRenders),
173+ imageRenders: {}..addAll (customImageRenders)..addAll (defaultImageRenders),
175174 tagsList: tagsList.isEmpty ? Html .tags : tagsList,
176175 navigationDelegateForIframe: navigationDelegateForIframe,
177176 ),
@@ -211,34 +210,34 @@ class SelectableHtml extends StatelessWidget {
211210 /// (e.g. bold or italic), while container related styling (e.g. borders or padding/margin)
212211 /// do not work because we can't use the `ContainerSpan` class (it needs an enclosing `WidgetSpan` ).
213212
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 ,
226225 assert (data != null ),
227226 _anchorKey = anchorKey ?? GlobalKey (),
228227 super (key: key);
229228
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 ,
242241 assert (document != null ),
243242 _anchorKey = anchorKey ?? GlobalKey (),
244243 super (key: key);
@@ -249,8 +248,8 @@ class SelectableHtml extends StatelessWidget {
249248 /// The HTML data passed to the widget as a String
250249 final String ? data;
251250
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;
254253
255254 /// A function that defines what to do when a link is tapped
256255 final OnTap ? onLinkTap;
@@ -280,7 +279,7 @@ class SelectableHtml extends StatelessWidget {
280279
281280 @override
282281 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! ;
284283 final double ? width = shrinkWrap ? null : MediaQuery .of (context).size.width;
285284
286285 return Container (
0 commit comments