flutter_html 0.5.4
flutter_html: ^0.5.4 copied to clipboard
A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 60 different html tags!)
flutter_html #
A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 60 different html tags!)
Installing: #
Add the following to your pubspec.yaml file:
dependencies:
flutter_html: ^0.5.4
Currently Supported HTML Tags: #
aabbraddressarticleasidebbdibdoblockquotebodybrcaptioncitecodedatadddeldfndivdldtemfigcaptionfigurefooterh1h2h3h4h5h6headerhriimginskbdlimainmarknavnoscriptppreqrprtrubyssampsectionsmallspanstrike(legacy html tag)strongtabletbodytdtemplatetfootththeadtimetrtt(legacy html tag)uvar
Partially supported elements: #
These are common elements that aren't yet fully supported, but won't be ignored and will still render.
olul
List of planned supported elements: #
These are elements that are planned, but present a specific challenge that makes them somewhat difficult to implement.
audiodetailssourcesubsummarysupsvgtrackvideowbr
Here are a list of elements that I don't plan on implementing: #
Feel free to open an issue if you have a good reason and feel like you can convince me to implement them. A well written and complete pull request implementing one of these is always welcome, though I cannot promise I will merge them.
Note: These unsupported tags will just be ignored.
acronym(deprecated, useabbrinstead)applet(deprecated)areabase(headelements are not rendered)basefont(deprecated, use defaultTextStyle onHtmlwidget instead)big(deprecated)buttoncanvascenter(deprecated)colcolgroupdatalistdialogdir(deprecated)embedfont(deprecated)fieldset(formelements are outside the scope of this package)form(forms are outside the scope of this package)frame(deprecated)frameset(deprecated)head(headelements are not rendered)iframeinput(formelements are outside the scope of this package)label(formelements are outside the scope of this package)legend(formelements are outside the scope of this package)link(headelements are not rendered)mapmeta(headelements are not rendered)meter(outside the scope for now; maybe later)noframe(deprecated)objectoptgroup(formelements are outside the scope of this package)option(formelements are outside the scope of this package)outputparampictureprogressscriptselect(formelements are outside the scope of this package)styletextarea(formelements are outside the scope of this package)title(headelements are not rendered)
Why this package? #
This package is designed with simplicity in mind. Flutter currently does not support rendering of web content into the widget tree. This package is designed to be a reasonable alternative for rendering static web content until official support is added.
Example Usage: #
Html(
data: """
<div>
<h1>Demo Page</h1>
<p>This is a fantastic nonexistent product that you should buy!</p>
<h2>Pricing</h2>
<p>Lorem ipsum <b>dolor</b> sit amet.</p>
<h2>The Team</h2>
<p>There isn't <i>really</i> a team...</p>
<h2>Installation</h2>
<p>You <u>cannot</u> install a nonexistent product!</p>
</div>
""",
//Optional parameters:
padding: EdgeInsets.all(8.0),
backgroundColor: Colors.white70,
defaultTextStyle: TextStyle(fontFamily: 'serif'),
onLinkTap: (url) {
// open url in a webview
}
)