HTML5 constructor
- Key? key,
- GlobalKey<
State< ? anchorKey,StatefulWidget> > - required String? data,
- OnTap? onLinkTap,
- OnTap? onAnchorTap,
- Map<
CustomRenderMatcher, CustomRender> customRenders = const {}, - OnCssParseError? onCssParseError,
- ImageErrorListener? onImageError,
- bool shrinkWrap = false,
- OnTap? onImageTap,
- List<
String> tagsList = const [], - Map<
String, CSS3> 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).
onLinkTap This function is called whenever a link
(<a href>
) is tapped.
customRender This function allows you to return
your own widgets for existing or custom HTML tags.
See its wiki page
for more info.
onImageError This is called whenever an image fails to load or display on the page.
shrinkWrap This makes the Html widget take up only the width it needs and no more.
onImageTap This is called whenever an image is tapped.
tagsList Tag names in this array will be the only tags rendered. By default all supported HTML tags are rendered.
style Pass in the style information for the Html here. See its wiki page for more info.
Implementation
HTML5({
Key? key,
GlobalKey? anchorKey,
required this.data,
this.onLinkTap,
this.onAnchorTap,
this.customRenders = const {},
this.onCssParseError,
this.onImageError,
this.shrinkWrap = false,
this.onImageTap,
this.tagsList = const [],
this.style = const {},
}) : documentElement = null,
assert(data != null),
_anchorKey = anchorKey ?? GlobalKey(),
super(key: key);