diff --git a/README.md b/README.md index 2fa927abbc..2a6533bf5a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ A Flutter widget for rendering HTML and CSS as Flutter widgets. - [API Reference](#api-reference) - [Constructors](#constructors) + + - [Selectable Text](#selectable-text) - [Parameters Table](#parameters) @@ -143,7 +145,7 @@ For a full example, see [here](https://github.com/Sub6Resources/flutter_html/tre Below, you will find brief descriptions of the parameters the`Html` widget accepts and some code snippets to help you use this package. -## Constructors: +### Constructors: The package currently has two different constructors - `Html()` and `Html.fromDom()`. @@ -151,6 +153,22 @@ The `Html()` constructor is for those who would like to directly pass HTML from If you would like to modify or sanitize the HTML before rendering it, then `Html.fromDom()` is for you - you can convert the HTML string to a `Document` and use its methods to modify the HTML as you wish. Then, you can directly pass the modified `Document` to the package. This eliminates the need to parse the modified `Document` back to a string, pass to `Html()`, and convert back to a `Document`, thus cutting down on load times. +#### Selectable Text + +The package also has two constructors for selectable text support - `SelectableHtml()` and `SelectableHtml.fromDom()`. + +The difference between the two is the same as noted above. + +Please note: Due to Flutter [#38474](https://github.com/flutter/flutter/issues/38474), selectable text support is significantly watered down compared to the standard non-selectable version of the widget. The changes are as follows: + +1. The list of tags that can be rendered is significantly reduced. Key omissions include no support for images/video/audio, table, and ul/ol. + +2. No support for `customRender`, `customImageRender`, `onImageError`, `onImageTap`, `onMathError`, and `navigationDelegateForIframe`. (Support for `customRender` may be added in the future). + +3. Styling support is significantly reduced. Only text-related styling works (e.g. bold or italic), while container related styling (e.g. borders or padding/margin) do not work. + +Once the above issue is resolved, the aforementioned compromises will go away. Currently the `SelectableText.rich()` constructor does not support `WidgetSpan`s, resulting in the feature losses above. + ### Parameters: | Parameters | Description | @@ -170,7 +188,9 @@ If you would like to modify or sanitize the HTML before rendering it, then `Html ### Getters: -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. +1. `Html.tags`. This provides a list of all the tags the package renders. The main use case is to assist in excluding elements using `tagsList`. See an [example](#example-usage---tagslist---excluding-tags) below. + +2. `SelectableHtml.tags`. This provides a list of all the tags that can be rendered in selectable mode. ### Data: @@ -419,7 +439,7 @@ A list of elements the `Html` widget should render. The list should contain the #### Example Usage - tagsList - Excluding Tags: 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 `