How to apply external css to html render in flutter webview
4,351
You can submit any JavaScript to your webview by calling :
flutterWebViewPlugin.evalJavascript(js);
In you JavaScript you can add CSS styles using some of the solutions described here. For instance:
// Create our shared stylesheet:
const sheet = new CSSStyleSheet();
sheet.replaceSync('#target {color: darkseagreen}');
// Apply the stylesheet to a document:
document.adoptedStyleSheets = [sheet];
Author by
Akshata
Updated on November 19, 2022Comments
-
Akshata about 1 month
I want to apply external css to html which is render in flutter webview.In android it is done using follwing syntax.
-
satish about 3 yearsFlutter Does't provide to render complete HTML or CSS, code, you can use WebView, WebView is kind of Web browser which is very expensive widget, it might slow down you app, I would recommend go with widget only.