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.8k stars 874 forks source link

feat: Add WrapperExtension helper #1264

Closed Sub6Resources closed 1 year ago

Sub6Resources commented 1 year ago

Fixes #1262

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 94.64% and project coverage change: +0.56 :tada:

Comparison is base (8ac444b) 57.16% compared to head (e467e3f) 57.73%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1264 +/- ## ========================================== + Coverage 57.16% 57.73% +0.56% ========================================== Files 36 37 +1 Lines 2610 2645 +35 ========================================== + Hits 1492 1527 +35 Misses 1118 1118 ``` | [Impacted Files](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker) | Coverage Δ | | |---|---|---| | [lib/src/builtins/details\_element\_builtin.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9idWlsdGlucy9kZXRhaWxzX2VsZW1lbnRfYnVpbHRpbi5kYXJ0) | `11.11% <0.00%> (ø)` | | | [lib/src/builtins/image\_builtin.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9idWlsdGlucy9pbWFnZV9idWlsdGluLmRhcnQ=) | `60.39% <ø> (ø)` | | | [lib/src/builtins/ruby\_builtin.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9idWlsdGlucy9ydWJ5X2J1aWx0aW4uZGFydA==) | `92.06% <ø> (ø)` | | | [lib/src/builtins/text\_builtin.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9idWlsdGlucy90ZXh0X2J1aWx0aW4uZGFydA==) | `95.83% <ø> (ø)` | | | [lib/src/extension/helpers/image\_extension.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9leHRlbnNpb24vaGVscGVycy9pbWFnZV9leHRlbnNpb24uZGFydA==) | `0.00% <0.00%> (ø)` | | | [lib/src/extension/helpers/image\_tap\_extension.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9leHRlbnNpb24vaGVscGVycy9pbWFnZV90YXBfZXh0ZW5zaW9uLmRhcnQ=) | `0.00% <0.00%> (ø)` | | | [lib/src/extension/helpers/matcher\_extension.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9leHRlbnNpb24vaGVscGVycy9tYXRjaGVyX2V4dGVuc2lvbi5kYXJ0) | `53.84% <ø> (ø)` | | | [lib/src/extension/helpers/tag\_extension.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9leHRlbnNpb24vaGVscGVycy90YWdfZXh0ZW5zaW9uLmRhcnQ=) | `58.33% <ø> (ø)` | | | [lib/src/extension/html\_extension.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-bGliL3NyYy9leHRlbnNpb24vaHRtbF9leHRlbnNpb24uZGFydA==) | `81.25% <ø> (ø)` | | | [...ackages/flutter\_html\_svg/lib/flutter\_html\_svg.dart](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker#diff-cGFja2FnZXMvZmx1dHRlcl9odG1sX3N2Zy9saWIvZmx1dHRlcl9odG1sX3N2Zy5kYXJ0) | `87.39% <ø> (ø)` | | | ... and [5 more](https://app.codecov.io/gh/Sub6Resources/flutter_html/pull/1264?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthew+Whitaker) | |

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

Sembauke commented 1 year ago

It might be hard for the user to know what the difference is between a TagExtension and a WrapperExtension class. Because they basically do the same thing?

Sub6Resources commented 1 year ago

Fair. I can add some more documentation. Essentially the TagExtension is for providing a custom widget in place of a tag. For example, rendering all <flutter> tags as a FlutterLogo widget. The WrapperExtension is for wrapping any instance of a tag inside of another widget, while still rendering the tag using the built-in tag support or other extensions.

Would naming like WrapTagExtension be clearer?

Sembauke commented 1 year ago

Yes, I think WrapTagExtension would make things a bit more clear. But I also think there should be some good documentation on what the differences are. Keep them close in the example too.

Sub6Resources commented 1 year ago

I just renamed the Extension and added a bit more documentation.

Some of the documentation is yet to come in the form of the wiki: https://github.com/Sub6Resources/flutter_html/wiki/How-To-Use-Extensions. Sorry my documentation isn't super flushed out yet!

Sembauke commented 1 year ago

No worries, I am only pointing these things out cause I am trying to help and make it better!