Html constructor
- Key? key,
- GlobalKey<
State< ? anchorKey,StatefulWidget> > - required String? data,
- OnTap? onLinkTap,
- OnTap? onAnchorTap,
- Map<
String, CustomRender> customRender = const {}, - Map<
ImageSourceMatcher, ImageRender> customImageRenders = const {}, - OnCssParseError? onCssParseError,
- ImageErrorListener? onImageError,
- OnMathError? onMathError,
- bool shrinkWrap = false,
- OnTap? onImageTap,
- List<
String> tagsList = const [], - 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).
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
Html({
Key? key,
GlobalKey? anchorKey,
required this.data,
this.onLinkTap,
this.onAnchorTap,
this.customRender = const {},
this.customImageRenders = const {},
this.onCssParseError,
this.onImageError,
this.onMathError,
this.shrinkWrap = false,
this.onImageTap,
this.tagsList = const [],
this.style = const {},
this.navigationDelegateForIframe,
}) : document = null,
assert(data != null),
_anchorKey = anchorKey ?? GlobalKey(),
super(key: key);