Skip to content

Commit 71a7095

Browse files
Merge pull request Sub6Resources#22 from kieferlam/ul-add-point
Add bullet points to <ul> list items
2 parents 20a3ff2 + afae3df commit 71a7095

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/html_parser.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,27 @@ class HtmlParser {
472472
),
473473
);
474474
case "li":
475+
String type = node.parent.localName; // Parent type; usually ol or ul
476+
EdgeInsets markPadding = EdgeInsets.symmetric(horizontal: 4.0);
477+
Widget mark;
478+
switch (type) {
479+
case "ul":
480+
mark = Container(child: Text('•'), padding: markPadding);
481+
break;
482+
case "ol": //TODO Use index as mark
483+
mark = Container(child: Text('•'), padding: markPadding);
484+
break;
485+
default: //Fallback to middle dot
486+
mark = Container(width: 0.0, height: 0.0);
487+
break;
488+
}
475489
return Container(
476490
width: width,
477491
child: Wrap(
478-
children: _parseNodeList(node.nodes),
492+
children: <Widget>[
493+
mark,
494+
Wrap(children: _parseNodeList(node.nodes))
495+
],
479496
),
480497
);
481498
case "main":

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage: https://github.com/Sub6Resources/flutter_html
66

77
environment:
88
sdk: '>=1.19.0 <3.0.0'
9-
flutter: '>=0.5.0 <0.8.0'
9+
flutter: '>=0.5.0'
1010

1111
dependencies:
1212
html: ^0.13.3

0 commit comments

Comments
 (0)