Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.79k stars 860 forks source link

Fix Lists and upgrade List support to CSS3 #1161

Closed Sub6Resources closed 1 year ago

Sub6Resources commented 1 year ago

The new CssBoxWidget allows us to effectively render a "marker box" on elements, especially list elements. This upgrade fixes almost all of our open list issues. It removes support for custom Widget list markers, since CSS doesn't support that (however, the same functionality could easily be re-added in a CustomRender by interested parties).

This pull request also removes the roman-numeral-specific numerus dependency in favor of the more general list_counter dependency (disclosure: package written by myself). This change in dependency allows us to expand our list style support to 54 different list-styles, including dozens of new languages.

This pull request fixes the following open and tightly-related issues:

Fixes #1100

Screen Shot 2022-10-08 at 2 55 19 PM

Fixes #245

Screen Shot 2022-10-08 at 2 58 22 PM

Fixes #984

Screen Shot 2022-10-08 at 3 00 37 PM

Fixes #991

Screen Shot 2022-10-08 at 3 02 01 PM

Fixes #1016

Screen Shot 2022-10-08 at 3 03 54 PM

Fixes #1020

Screen Shot 2022-10-08 at 3 08 53 PM

Fixes #1104

Screen Shot 2022-10-08 at 3 02 01 PM

This pull request is a work in progress ready to go. Still to do:

codecov[bot] commented 1 year ago

Codecov Report

Base: 49.70% // Head: 51.41% // Increases project coverage by +1.71% :tada:

Coverage data is based on head (91a7e70) compared to base (cb23cf0). Patch coverage: 79.05% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1161 +/- ## ========================================== + Coverage 49.70% 51.41% +1.71% ========================================== Files 18 19 +1 Lines 2682 2641 -41 ========================================== + Hits 1333 1358 +25 + Misses 1349 1283 -66 ``` | [Impacted Files](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker) | Coverage Δ | | |---|---|---| | [lib/src/css\_parser.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9jc3NfcGFyc2VyLmRhcnQ=) | `13.83% <0.00%> (+0.19%)` | :arrow_up: | | [lib/style.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3N0eWxlLmRhcnQ=) | `85.36% <69.23%> (+0.59%)` | :arrow_up: | | [lib/src/css\_box\_widget.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9jc3NfYm94X3dpZGdldC5kYXJ0) | `64.28% <76.66%> (-0.19%)` | :arrow_down: | | [lib/html\_parser.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL2h0bWxfcGFyc2VyLmRhcnQ=) | `83.96% <90.19%> (+10.61%)` | :arrow_up: | | [lib/custom\_render.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL2N1c3RvbV9yZW5kZXIuZGFydA==) | `50.96% <100.00%> (-0.62%)` | :arrow_down: | | [lib/src/style/marker.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9zdHlsZS9tYXJrZXIuZGFydA==) | `100.00% <100.00%> (ø)` | | | [lib/src/styled\_element.dart](https://codecov.io/gh/Sub6Resources/flutter_html/pull/1161/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9zdHlsZWRfZWxlbWVudC5kYXJ0) | `80.21% <100.00%> (+1.06%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Sub6Resources commented 1 year ago

@erickok If you wouldn't mind doing a quick rereview on the most recent commit (which re-adds basic list-style-image support), that would be great. I also cleaned a few things up so there isn't as much repeated code.