Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bullet points to <ul> list items #22

Merged
merged 5 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,27 @@ class HtmlParser {
),
);
case "li":
String type = node.parent.localName; // Parent type; usually ol or ul
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);
break;
default: //Fallback to middle dot
mark = Container(width: 0.0, height: 0.0);
break;
}
return Container(
width: width,
child: Wrap(
children: _parseNodeList(node.nodes),
child: Row(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could change this from Row to Wrap that would be great. (Otherwise lines will overflow to the right rather than wrapping when they get long)

children: <Widget>[
mark,
Wrap(children: _parseNodeList(node.nodes))
],
),
);
case "main":
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage: https://github.com/Sub6Resources/flutter_html

environment:
sdk: '>=1.19.0 <3.0.0'
flutter: '>=0.5.0 <0.8.0'
flutter: '>=0.5.0'

dependencies:
html: ^0.13.3
Expand Down