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
// no need for a scrolling gesture recognizer for embedded youtube videos so we only use VerticalDragGestureRecognizer when the iframe does not display embedded youtube videos
// no need for a scrolling gesture recognizer for embedded youtube videos so we only use VerticalDragGestureRecognizer when the iframe does not display embedded youtube videos
if (attributes['src'].contains("youtube.com/embed")) {
269
+
if (!request.url.contains("youtube.com/embed")) {
270
+
return ShouldOverrideUrlLoadingAction.CANCEL;
316
271
} else {
317
-
return Container(height: 0);
272
+
return ShouldOverrideUrlLoadingAction.ALLOW;
318
273
}
274
+
} else {
275
+
return ShouldOverrideUrlLoadingAction.ALLOW;
319
276
}
320
-
}
321
-
),
322
-
),
323
-
);
324
-
}
325
-
}
277
+
},
278
+
),
279
+
);
280
+
// if the src of the iframe is null then do not render anything
281
+
} else {
282
+
return Container(height: 0);
283
+
}
284
+
}
285
+
}
286
+
),
326
287
```
327
288
</details>
328
289
@@ -363,12 +324,17 @@ Widget html = Html(
363
324
A list of elements the `Html` widget should not render. The list should contain the tags of the HTML elements you wish to blacklist.
364
325
365
326
#### Example Usage - blacklistedElements:
366
-
`h1` will render, but `h2` will not render
327
+
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.
328
+
329
+
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