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

update readme for subpackages for migration from CustomRender to HtmlExtension #1344

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions packages/flutter_html_audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ This package renders audio elements using the [`chewie_audio`](https://pub.dev/p

The package considers the attributes `controls`, `loop`, `src`, `autoplay`, `width`, and `muted` when rendering the audio widget.

#### Registering the `CustomRender`:
#### Registering the `AudioHtmlExtension`:

```dart
Widget html = Html(
customRenders: {
audioMatcher(): audioRender(),
extensions: {
AudioHtmlExtension(),
}
);
```
```
12 changes: 6 additions & 6 deletions packages/flutter_html_iframe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ When rendering iframes, the package considers the width, height, and sandbox att

Sandbox controls the JavaScript mode of the webview - a value of `null` or `allow-scripts` will set `javascriptMode: JavascriptMode.unrestricted`, otherwise it will set `javascriptMode: JavascriptMode.disabled`.

#### Registering the `CustomRender`:
#### Registering the `IframeHtmlExtension`:

```dart
Widget html = Html(
customRenders: {
iframeMatcher(): iframeRender(),
extensions: {
IframeHtmlExtension(),
}
);
```
You can set the `navigationDelegate` of the webview with the `navigationDelegate` property on `iframeRender`. This allows you to block or allow the loading of certain URLs.
You can set the `navigationDelegate` of the webview with the `navigationDelegate` property on `IframeHtmlExtension`. This allows you to block or allow the loading of certain URLs.

#### `NavigationDelegate` example:

```dart
Widget html = Html(
customRenders: {
iframeMatcher(): iframeRender(navigationDelegate: (NavigationRequest request) {
extensions: {
IframeHtmlExtension(navigationDelegate: (NavigationRequest request) {
if (request.url.contains("google.com/images")) {
return NavigationDecision.prevent;
} else {
Expand Down
14 changes: 7 additions & 7 deletions packages/flutter_html_math/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ When rendering MathML, the package takes the MathML data within the `<math>` tag

Because this package is parsing MathML to Tex, it may not support some functionalities. The current list of supported tags can be found [above](#currently-supported-html-tags), but some of these only have partial support at the moment.

#### Registering the `CustomRender`:
#### Registering the `MathHtmlExtension`:

```dart
Widget html = Html(
customRenders: {
mathMatcher(): mathRender(),
extensions: {
MathHtmlExtension(),
}
);
```

If the parsing errors, you can use the `onMathError` property of `mathRender` to catch the error and potentially fix it on your end.
If the parsing errors, you can use the `onMathError` property of `MathHtmlExtension` to catch the error and potentially fix it on your end.

The function exposes the parsed Tex `String`, as well as the error and error with type from `flutter_math_fork` as a `String`.

Expand All @@ -28,12 +28,12 @@ You can analyze the error and the parsed string, and finally return a new instan

```dart
Widget html = Html(
customRenders: {
mathMatcher(): mathRender(onMathError: (tex, exception, exceptionWithType) {
extensions: {
MathHtmlExtension(onMathError: (tex, exception, exceptionWithType) {
print(exception);
//optionally try and correct the Tex string here
return Text(exception);
}),
}
);
```
```
9 changes: 3 additions & 6 deletions packages/flutter_html_svg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ When rendering SVGs, the package takes the SVG data within the `<svg>` tag and p

The package also exposes a few ways to render SVGs within an `<img>` tag, specifically base64 SVGs, asset SVGs, and network SVGs.

#### Registering the `CustomRender`:
#### Registering the `SvgHtmlExtension`:

```dart
Widget html = Html(
customRenders: {
svgTagMatcher(): svgTagRender(),
svgDataUriMatcher(): svgDataImageRender(),
svgAssetUriMatcher(): svgAssetImageRender(),
svgNetworkSourceMatcher(): svgNetworkImageRender(),
extensions: {
SvgHtmlExtension(),
}
);
```
6 changes: 3 additions & 3 deletions packages/flutter_html_table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ This package renders table elements using the [`flutter_layout_grid`](https://pu

When rendering table elements, the package tries to calculate the best fit for each element and size its cell accordingly. `Rowspan`s and `colspan`s are considered in this process, so cells that span across multiple rows and columns are rendered as expected. Heights are determined intrinsically to maintain an optimal aspect ratio for the cell.

#### Registering the `CustomRender`:
#### Registering the `TableHtmlExtension`:

```dart
Widget html = Html(
customRenders: {
tableMatcher(): tableRender(),
extensions: {
TableHtmlExtension(),
}
);
```
8 changes: 4 additions & 4 deletions packages/flutter_html_video/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ This package renders video elements using the [`chewie`](https://pub.dev/package

The package considers the attributes `controls`, `loop`, `src`, `autoplay`, `poster`, `width`, `height`, and `muted` when rendering the video widget.

#### Registering the `CustomRender`:
#### Registering the `VideoHtmlExtension`:

```dart
Widget html = Html(
customRenders: {
videoMatcher(): videoRender(),
extensions: {
VideoHtmlExtension(),
}
);
```
```