Html constructor
- Key? key,
- GlobalKey<
State< ? anchorKey,StatefulWidget> > - required String? data,
- OnTap? onLinkTap,
- OnTap? onAnchorTap,
- List<
HtmlExtension> extensions = const [], - OnCssParseError? onCssParseError,
- bool shrinkWrap = false,
- Set<
String> ? onlyRenderTheseTags, - Set<
String> ? doNotRenderTheseTags, - Map<
String, Style> style = const {},
The Html
widget takes HTML as input and displays a RichText
tree of the parsed HTML content.
Attributes
data required takes in a String of HTML data (required only for Html
constructor).
document required takes in a Document of HTML data (required only for Html.fromDom
constructor).
extensions A list of Extension
s that add additional capabilities to flutter_html
See the Extension
class for more details.
onLinkTap This function is called whenever a link (<a href>
)
is tapped.
shrinkWrap This makes the Html widget take up only the width it needs and no more.
onlyRenderTheseTags provides an exclusive list of tags to render.
doNotRenderTheseTags provides a short list of tags that the Html widget should completely ignore.
style Pass in the style information for the Html here. See its wiki page for more info.
Implementation
Html({
Key? key,
GlobalKey? anchorKey,
required this.data,
this.onLinkTap,
this.onAnchorTap,
this.extensions = const [],
this.onCssParseError,
this.shrinkWrap = false,
this.onlyRenderTheseTags,
this.doNotRenderTheseTags,
this.style = const {},
}) : documentElement = null,
assert(data != null),
_anchorKey = anchorKey ?? GlobalKey(),
super(key: key);