Skip to content

Commit

Permalink
Version 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sub6Resources committed Aug 25, 2018
1 parent cea2c4a commit 8e0b497
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 60 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## [0.5.1] - August 25, 2018:

* Fixed issue with table rows not lining up correctly ([#4](https://github.com/Sub6Resources/flutter_html/issues/4))

## [0.5.0] - August 23, 2018:

* Major refactor that makes entire tree a Widget and eliminates the need to distinguish between inline and block elements.
* Fixed #7, #9, #10, and #11.
* Fixed [#7](https://github.com/Sub6Resources/flutter_html/issues/7), [#9](https://github.com/Sub6Resources/flutter_html/issues/9), [#10](https://github.com/Sub6Resources/flutter_html/issues/10), and [#11](https://github.com/Sub6Resources/flutter_html/issues/11).

## [0.4.1] - August 15, 2018:

* Fixed issue with images not loading when inside of `p` tag (#6)
* Fixed issue with images not loading when inside of `p` tag ([#6](https://github.com/Sub6Resources/flutter_html/issues/6))

## [0.4.0] - August 15, 2018:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A Flutter widget for rendering static html tags as Flutter widgets. (Will render
Add the following to your `pubspec.yaml` file:

dependencies:
flutter_html: ^0.5.0
flutter_html: ^0.5.1

## Currently Supported HTML Tags:

Expand Down
31 changes: 25 additions & 6 deletions lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ class HtmlParser {
}
return Container(width: width);
case "caption":
return Wrap(
children: _parseNodeList(node.nodes),
return Container(
width: width,
child: Wrap(
alignment: WrapAlignment.center,
children: _parseNodeList(node.nodes),
),
);
case "cite":
return DefaultTextStyle.merge(
Expand Down Expand Up @@ -532,8 +536,15 @@ class HtmlParser {
crossAxisAlignment: CrossAxisAlignment.start,
);
case "td":
return Row(
children: _parseNodeList(node.nodes),
int colspan = 1;
if (node.attributes['colspan'] != null) {
colspan = int.tryParse(node.attributes['colspan']);
}
return Expanded(
flex: colspan,
child: Wrap(
children: _parseNodeList(node.nodes),
),
);
case "template":
//Not usually displayed in HTML
Expand All @@ -544,9 +555,17 @@ class HtmlParser {
crossAxisAlignment: CrossAxisAlignment.start,
);
case "th":
int colspan = 1;
if (node.attributes['colspan'] != null) {
colspan = int.tryParse(node.attributes['colspan']);
}
return DefaultTextStyle.merge(
child: Wrap(
children: _parseNodeList(node.nodes),
child: Expanded(
flex: colspan,
child: Wrap(
alignment: WrapAlignment.center,
children: _parseNodeList(node.nodes),
),
),
style: const TextStyle(
fontWeight: FontWeight.bold,
Expand Down
Loading

0 comments on commit 8e0b497

Please sign in to comment.