File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,32 @@ Widget html = Html(
271271);
272272```
273273
274- 2 . Complex example - rendering an ` iframe ` differently based on whether it is an embedded youtube video or some other embedded content
274+ 2 . Complex example - wrapping the default widget with your own, in this case placing a horizontal scroll around a (potentially too wide) table.
275+
276+ <details ><summary >View code</summary >
277+
278+ ``` dart
279+ Widget html = Html(
280+ data: """
281+ <table style="width:100%">
282+ <caption>Monthly savings</caption>
283+ <tr> <th>January</th> <th>February</th> <th>March</th> <th>April</th> <th>May</th> <th>June</th> <th>July</th> <th>August</th> <th>September</th> <th>October</th> <th>November</th> <th>December</th> </tr>
284+ <tr> <td>\$100</td> <td>\$50</td> <td>\$80</td> <td>\$60</td> <td>\$90</td> <td>\$140</td> <td>\$110</td> <td>\$80</td> <td>\$90</td> <td>\$60</td> <td>\$40</td> <td>\$70</td> </tr>
285+ <tr> <td>\90</td> <td>\$60</td> <td>\$80</td> <td>\$80</td> <td>\$100</td> <td>\$160</td> <td>\$150</td> <td>\$110</td> <td>\$100</td> <td>\$60</td> <td>\$30</td> <td>\$80</td> </tr>
286+ </table>
287+ """,
288+ customRender: {
289+ "table": (context, child) {
290+ return SingleChildScrollView(
291+ scrollDirection: Axis.horizontal,
292+ child: (context.tree as TableLayoutElement).toWidget(context),
293+ );
294+ }
295+ },
296+ );
297+ ```
298+
299+ 3 . Complex example - rendering an ` iframe ` differently based on whether it is an embedded youtube video or some other embedded content.
275300
276301<details ><summary >View code</summary >
277302
You can’t perform that action at this time.
0 commit comments