admin管理员组文章数量:1287164
How can I load different local HTML files into a WebView in Flutter depending on the language and whether the dark or light mode is active? Unless the system language is set to German, should the English language files be loaded depending on whether the dark or light mode is active?
I have tried it with the following code
void initState() {
super.initState();
if(languageCode == "de" && Theme.of(context).brightness == Brightness.light){
_controller = WebViewController();
_controller.loadFlutterAsset('assets/html/heading_de.html');
}else if(languageCode == "de" && Theme.of(context).brightness == Brightness.dark) {
_controller = WebViewController();
_controller.loadFlutterAsset('assets/html/heading_de.html');
}
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: WebViewWidget(controller: _controller),
);
} }
But without success.
Can someone please give me a tip on the best way to do this.
Best regards Petra Ritter
本文标签: How to load different HTML files in a webView on flutterStack Overflow
版权声明:本文标题:How to load different HTML files in a webView on flutter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741307418a2371453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论