Skip to content

Commit be621b9

Browse files
Merge pull request #1344 from ndusart/readme
update readme for subpackages for migration from CustomRender to HtmlExtension
2 parents edd2a78 + 6d90bd7 commit be621b9

File tree

6 files changed

+27
-30
lines changed

6 files changed

+27
-30
lines changed

packages/flutter_html_audio/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This package renders audio elements using the [`chewie_audio`](https://pub.dev/p
66

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

9-
#### Registering the `CustomRender`:
9+
#### Registering the `AudioHtmlExtension`:
1010

1111
```dart
1212
Widget html = Html(
13-
customRenders: {
14-
audioMatcher(): audioRender(),
13+
extensions: {
14+
AudioHtmlExtension(),
1515
}
1616
);
17-
```
17+
```

packages/flutter_html_iframe/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ When rendering iframes, the package considers the width, height, and sandbox att
88

99
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`.
1010

11-
#### Registering the `CustomRender`:
11+
#### Registering the `IframeHtmlExtension`:
1212

1313
```dart
1414
Widget html = Html(
15-
customRenders: {
16-
iframeMatcher(): iframeRender(),
15+
extensions: {
16+
IframeHtmlExtension(),
1717
}
1818
);
1919
```
20-
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.
20+
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.
2121

2222
#### `NavigationDelegate` example:
2323

2424
```dart
2525
Widget html = Html(
26-
customRenders: {
27-
iframeMatcher(): iframeRender(navigationDelegate: (NavigationRequest request) {
26+
extensions: {
27+
IframeHtmlExtension(navigationDelegate: (NavigationRequest request) {
2828
if (request.url.contains("google.com/images")) {
2929
return NavigationDecision.prevent;
3030
} else {

packages/flutter_html_math/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ When rendering MathML, the package takes the MathML data within the `<math>` tag
88

99
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.
1010

11-
#### Registering the `CustomRender`:
11+
#### Registering the `MathHtmlExtension`:
1212

1313
```dart
1414
Widget html = Html(
15-
customRenders: {
16-
mathMatcher(): mathRender(),
15+
extensions: {
16+
MathHtmlExtension(),
1717
}
1818
);
1919
```
2020

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

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

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

2929
```dart
3030
Widget html = Html(
31-
customRenders: {
32-
mathMatcher(): mathRender(onMathError: (tex, exception, exceptionWithType) {
31+
extensions: {
32+
MathHtmlExtension(onMathError: (tex, exception, exceptionWithType) {
3333
print(exception);
3434
//optionally try and correct the Tex string here
3535
return Text(exception);
3636
}),
3737
}
3838
);
39-
```
39+
```

packages/flutter_html_svg/README.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ When rendering SVGs, the package takes the SVG data within the `<svg>` tag and p
88

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

11-
#### Registering the `CustomRender`:
11+
#### Registering the `SvgHtmlExtension`:
1212

1313
```dart
1414
Widget html = Html(
15-
customRenders: {
16-
svgTagMatcher(): svgTagRender(),
17-
svgDataUriMatcher(): svgDataImageRender(),
18-
svgAssetUriMatcher(): svgAssetImageRender(),
19-
svgNetworkSourceMatcher(): svgNetworkImageRender(),
15+
extensions: {
16+
SvgHtmlExtension(),
2017
}
2118
);
2219
```

packages/flutter_html_table/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This package renders table elements using the [`flutter_layout_grid`](https://pu
66

77
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.
88

9-
#### Registering the `CustomRender`:
9+
#### Registering the `TableHtmlExtension`:
1010

1111
```dart
1212
Widget html = Html(
13-
customRenders: {
14-
tableMatcher(): tableRender(),
13+
extensions: {
14+
TableHtmlExtension(),
1515
}
1616
);
1717
```

packages/flutter_html_video/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This package renders video elements using the [`chewie`](https://pub.dev/package
66

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

9-
#### Registering the `CustomRender`:
9+
#### Registering the `VideoHtmlExtension`:
1010

1111
```dart
1212
Widget html = Html(
13-
customRenders: {
14-
videoMatcher(): videoRender(),
13+
extensions: {
14+
VideoHtmlExtension(),
1515
}
1616
);
17-
```
17+
```

0 commit comments

Comments
 (0)