You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ A Flutter widget for rendering HTML and CSS as Flutter widgets.
36
36
-[Constructors](#constructors)
37
37
38
38
-[Parameters Table](#parameters)
39
+
40
+
-[Getters](#getters)
39
41
40
42
-[Data](#data)
41
43
@@ -51,7 +53,7 @@ A Flutter widget for rendering HTML and CSS as Flutter widgets.
51
53
52
54
-[onImageTap](#onimagetap)
53
55
54
-
-[blacklistedElements](#blacklistedelements)
56
+
-[tagsList](#tagslist)
55
57
56
58
-[style](#style)
57
59
@@ -161,11 +163,15 @@ If you would like to modify or sanitize the HTML before rendering it, then `Html
161
163
|`omMathError`| A function that defines what the widget should do when a math fails to render. The function exposes the parsed Tex `String`, as well as the error and error with type from `flutter_math` as a `String`. |
162
164
|`shrinkWrap`| A `bool` used while rendering different widgets to specify whether they should be shrink-wrapped or not, like `ContainerSpan`|
163
165
|`onImageTap`| A function that defines what the widget should do when an image is tapped. The function exposes the `src` of the image as a `String` to use in your implementation. |
164
-
|`blacklistedElements`| A list of elements the `Html` widget should not render. The list should contain the tags of the HTML elements you wish to blacklist. |
166
+
|`tagsList`| A list of elements the `Html` widget should render. The list should contain the tags of the HTML elements you wish to include. |
165
167
|`style`| A powerful API that allows you to customize the style that should be used when rendering a specific HTMl tag. |
166
168
|`navigationDelegateForIframe`| Allows you to set the `NavigationDelegate` for the `WebView`s of all the iframes rendered by the `Html` widget. |
167
169
|`customImageRender`| A powerful API that allows you to fully customize how images are loaded. |
168
170
171
+
### Getters:
172
+
173
+
Currently the only getter is `Html.tags`. This provides a list of all the tags the package renders. The main use case is to assist in blacklisting elements using `tagsList`. See an [example](#example-usage---tagslist---excluding-tags) below.
174
+
169
175
### Data:
170
176
171
177
The HTML data passed to the `Html` widget as a `String`. This is required and cannot be null when using `Html`.
@@ -375,25 +381,43 @@ Widget html = Html(
375
381
);
376
382
```
377
383
378
-
### blacklistedElements:
384
+
### tagsList:
379
385
380
-
A list of elements the `Html` widget should not render. The list should contain the tags of the HTML elements you wish to blacklist.
386
+
A list of elements the `Html` widget should render. The list should contain the tags of the HTML elements you wish to whitelist.
381
387
382
-
#### Example Usage - blacklistedElements:
388
+
#### Example Usage - tagsList - Excluding Tags:
383
389
You may have instances where you can choose between two different types of HTML tags to display the same content. In the example below, the `<video>` and `<iframe>` elements are going to display the same content.
384
390
385
391
The `blacklistedElements` parameter allows you to change which element is rendered. Iframes can be advantageous because they allow parallel loading - Flutter just has to wait for the webview to be initialized before rendering the page, possibly cutting down on load time. Video can be advantageous because it provides a 100% native experience with Flutter widgets, but it may take more time to render the page. You may know that Flutter webview is a little janky in its current state on Android, so using `blacklistedElements` and a simple condition, you can get the best of both worlds - choose the video widget to render on Android and the iframe webview to render on iOS.
0 commit comments