diff --git a/CHANGELOG.md b/CHANGELOG.md index a359be19fe..25be4f0e9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.7.0] - September 10, 2018: + +* Adds full support for `ul` + ## [0.6.2] - September 5, 2018: * Adds check for `img src` before trying to load it. diff --git a/README.md b/README.md index c54d2a45ad..8b5c308a54 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ 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.6.2 + flutter_html: ^0.7.0 ## Currently Supported HTML Tags: -`a`, `abbr`, `acronym`, `address`, `article`, `aside`, `b`, `bdi`, `bdo`, `big`, `blockquote`, `body`, `br`, `caption`, `cite`, `code`, `data`, `dd`, `del`, `dfn`, `div`, `dl`, `dt`, `em`, `figcaption`, `figure`, `footer`, `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `header`, `hr`, `i`, `img`, `ins`, `kbd`, `li`, `main`, `mark`, `nav`, `noscript`, `p`, `pre`, `q`, `rp`, `rt`, `ruby`, `s`, `samp`, `section`, `small`, `span`, `strike`, `strong`, `table`, `tbody`, `td`, `template`, `tfoot`, `th`, `thead`, `time`, `tr`, `tt`, `u`, `var` +`a`, `abbr`, `acronym`, `address`, `article`, `aside`, `b`, `bdi`, `bdo`, `big`, `blockquote`, `body`, `br`, `caption`, `cite`, `code`, `data`, `dd`, `del`, `dfn`, `div`, `dl`, `dt`, `em`, `figcaption`, `figure`, `footer`, `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `header`, `hr`, `i`, `img`, `ins`, `kbd`, `li`, `main`, `mark`, `nav`, `noscript`, `p`, `pre`, `q`, `rp`, `rt`, `ruby`, `s`, `samp`, `section`, `small`, `span`, `strike`, `strong`, `table`, `tbody`, `td`, `template`, `tfoot`, `th`, `thead`, `time`, `tr`, `tt`, `u`, `ul`, `var` ### Partially supported elements: > These are common elements that aren't yet fully supported, but won't be ignored and will still render somewhat correctly. -`center`, `ol` , `ul` +`center`, `ol` ### List of _planned_ supported elements: > These are elements that are planned, but present a specific challenge that makes them somewhat difficult to implement. diff --git a/lib/html_parser.dart b/lib/html_parser.dart index 6af8f3d12c..23198fe8bd 100644 --- a/lib/html_parser.dart +++ b/lib/html_parser.dart @@ -473,14 +473,15 @@ class HtmlParser { ); case "li": String type = node.parent.localName; // Parent type; usually ol or ul - EdgeInsets markPadding = EdgeInsets.symmetric(horizontal: 4.0); + const EdgeInsets markPadding = EdgeInsets.symmetric(horizontal: 4.0); Widget mark; switch (type) { case "ul": mark = Container(child: Text('•'), padding: markPadding); break; - case "ol": //TODO Use index as mark - mark = Container(child: Text('•'), padding: markPadding); + case "ol": + int index = node.parent.children.indexOf(node) + 1; + mark = Container(child: Text("$index."), padding: markPadding); break; default: //Fallback to middle dot mark = Container(width: 0.0, height: 0.0); diff --git a/pubspec.lock b/pubspec.lock index 7b1bb67945..5bb8a63f39 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -375,4 +375,4 @@ packages: version: "2.1.15" sdks: dart: ">=2.0.0-dev.68.0 <3.0.0" - flutter: ">=0.5.0 <0.8.0" + flutter: ">=0.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 22f738b0ff..39f1ebb2b8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_html description: A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 70 different html tags!) -version: 0.6.2 +version: 0.7.0 author: Matthew Whitaker homepage: https://github.com/Sub6Resources/flutter_html