uiWebView method
- required CWebViewController controller,
Provides an embedded web view via an iFrame to load other HTML documents.
Implementation
Widget uiWebView({required CWebViewController controller}) {
// Create the IFrame.
var iFrameElement = web.HTMLIFrameElement();
iFrameElement.style.height = "100%";
iFrameElement.style.width = "100%";
iFrameElement.style.border = 'none';
// Configure based on the controller configuration.
iFrameElement.allow = controller.allow;
iFrameElement.allowFullscreen = controller.allowFullScreen;
for (var sandbox in controller.sandbox) {
iFrameElement.sandbox.add(sandbox.sandbox);
}
iFrameElement.src = controller.url;
// Register it and return it.
var viewType = UniqueKey();
platformViewRegistry.registerViewFactory(
viewType.toString(),
(int viewId) => iFrameElement,
);
controller._iFrameRef = iFrameElement;
return HtmlElementView(
viewType: viewType.toString(),
);
}