@@ -50,38 +50,52 @@ class Html extends StatelessWidget {
5050 super (key: key);
5151
5252 Html .fromDom ({
53- Key key,
53+ Key ? key,
5454 @required this .document,
5555 this .onLinkTap,
56- this .customRender,
56+ this .customRender = const {} ,
5757 this .customImageRenders = const {},
5858 this .onImageError,
5959 this .shrinkWrap = false ,
6060 this .onImageTap,
6161 this .blacklistedElements = const [],
62- this .style,
62+ this .style = const {} ,
6363 this .navigationDelegateForIframe,
6464 }) : data = null ,
6565 assert (document != null ),
6666 super (key: key);
6767
68- final String data;
69- final dom.Document document;
68+ /// The HTML data passed to the widget as a String
69+ final String ? data;
70+
71+ /// The HTML data passed to the widget as a pre-processed [dom.Document]
72+ final dom.Document ? document;
73+
74+ /// A function that defines what to do when a link is tapped
7075 final OnTap ? onLinkTap;
76+
77+ /// An API that allows you to customize the entire process of image rendering.
78+ /// See the README for more details.
7179 final Map <ImageSourceMatcher , ImageRender > customImageRenders;
80+
81+ /// A function that defines what to do when an image errors
7282 final ImageErrorListener ? onImageError;
83+
84+ /// A parameter that should be set when the HTML widget is expected to be
85+ /// flexible
7386 final bool shrinkWrap;
7487
75- /// Properties for the Image widget that gets rendered by the rich text parser
88+ /// A function that defines what to do when an image is tapped
7689 final OnTap ? onImageTap;
7790
91+ /// A list of HTML tags that defines what elements are not rendered
7892 final List <String > blacklistedElements;
7993
8094 /// Either return a custom widget for specific node types or return null to
8195 /// fallback to the default rendering.
8296 final Map <String , CustomRender > customRender;
8397
84- /// Fancy New Parser parameters
98+ /// An API that allows you to override the default style for any HTML element
8599 final Map <String , Style > style;
86100
87101 /// Decides how to handle a specific navigation request in the WebView of an
@@ -91,7 +105,7 @@ class Html extends StatelessWidget {
91105
92106 @override
93107 Widget build (BuildContext context) {
94- final dom.Document doc = data != null ? HtmlParser .parseHTML (data) : document;
108+ final dom.Document doc = data != null ? HtmlParser .parseHTML (data! ) : document! ;
95109 final double ? width = shrinkWrap ? null : MediaQuery .of (context).size.width;
96110
97111 return Container (
0 commit comments