Skip to content

Commit

Permalink
Version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sub6Resources committed Aug 15, 2018
1 parent 633a2ab commit 0d2f1e1
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.4.0] - August 15, 2018:

* Adds support for `table`, `tbody`, `tfoot`, `thead`, `tr`, `td`, `th`, and `caption`

## [0.3.1] - August 15, 2018:

* Fixed issue where `p` was not rendered with the `defaultTextStyle`.
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# flutter_html

A Flutter widget for rendering static html tags as Flutter widgets.
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.3.1
flutter_html: ^0.4.0

## Currently Supported HTML Tags:

Expand All @@ -19,6 +19,7 @@ Add the following to your `pubspec.yaml` file:
* `blockquote`
* `body`
* `br`
* `caption`
* `cite`
* `code`
* `data`
Expand Down Expand Up @@ -61,8 +62,15 @@ Add the following to your `pubspec.yaml` file:
* `small`
* `span`
* `strong`
* `table`
* `tbody`
* `td`
* `template`
* `tfoot`
* `th`
* `thead`
* `time`
* `tr`
* `u`
* `var`

Expand All @@ -79,22 +87,12 @@ Add the following to your `pubspec.yaml` file:
* `audio`
* `bdi`
* `bdo`
* `caption`
* `col`
* `colgroup`
* `details`
* `source`
* `sub`
* `summary`
* `sup`
* `svg`
* `table`
* `tbody`
* `td`
* `tfoot`
* `th`
* `thead`
* `tr`
* `track`
* `video`
* `wbr`
Expand All @@ -115,6 +113,8 @@ Add the following to your `pubspec.yaml` file:
* `big` (deprecated)
* `button`
* `canvas`
* `col`
* `colgroup`
* `datalist`
* `dialog`
* `dir` (deprecated)
Expand Down
50 changes: 49 additions & 1 deletion lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class HtmlParser {
"blockquote",
"body",
"br",
"caption",
"cite",
"code",
"data",
Expand All @@ -42,7 +43,7 @@ class HtmlParser {
"img",
"ins",
"kbd",
"li", //partial
"li",
"main",
"mark",
"nav",
Expand All @@ -60,8 +61,15 @@ class HtmlParser {
"small",
"span",
"strong",
"table",
"tbody",
"td",
"template",
"tfoot",
"th",
"thead",
"time",
"tr",
"u",
"ul", //partial
"var",
Expand Down Expand Up @@ -150,6 +158,11 @@ class HtmlParser {
);
case "br":
return Container(height: 14.0);
case "caption":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.center,
);
case "cite":
return RichText(
text: TextSpan(
Expand Down Expand Up @@ -536,14 +549,49 @@ class HtmlParser {
],
style: defaultTextStyle,
));
case "table":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.start,
);
case "tbody":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.start,
);
case "td":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.center,
);
case "template":
return Container();
case "tfoot":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.start,
);
case "th":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.center,
);
case "thead":
return Column(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.start,
);
case "time":
return RichText(
text: TextSpan(
children: _parseInlineElement(node),
style: defaultTextStyle,
));
case "tr":
return Row(
children: _parseNodeList(node.nodes),
crossAxisAlignment: CrossAxisAlignment.center,
);
case "u":
return RichText(
text: TextSpan(
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_html
description: A Flutter widget for rendering static html tags as Flutter widgets.
version: 0.3.1
description: A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 60 different html tags!)
version: 0.4.0
author: Matthew Whitaker <sub6resources@gmail.com>
homepage: https://github.com/Sub6Resources/flutter_html

Expand Down

0 comments on commit 0d2f1e1

Please sign in to comment.