当前位置:网站首页>Shutter WebView example
Shutter WebView example
2022-07-04 21:32:00 【Boundless 6688】
load url
final Completer<WebViewController> _controller = Completer<WebViewController>();
int _progressValue = 0;
@override
void initState() {
super.initState();
// Enable hybrid composition.
if (Device.isAndroid) {
WebView.platform = SurfaceAndroidWebView();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
WebView(
initialUrl: "https://www.baidu.com",
javascriptMode: JavascriptMode.unrestricted,
allowsInlineMediaPlayback: true,
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
},
onProgress: (int progress) {
debugPrint('WebView is loading (progress : $progress%)');
setState(() {
_progressValue = progress;
});
},
),
if (_progressValue != 100) LinearProgressIndicator(
value: _progressValue / 100,
backgroundColor: Colors.transparent,
minHeight: 2,
) else Gaps.empty,
],
),
);
}
load html character string
String html = """
<!DOCTYPE html>
<html>
<head><meta name="viewport" content="width=device-width, initial-scale=1.0"></head>
<body>
<p>html String loading </p>
</body>
</html>
""";
return Scaffold(
appBar: AppBar(title: Text(widget.messageItem.title)),
body: WebView(
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController controller) {
controller.loadHtmlString(html);
},
),
);
边栏推荐
- __init__() missing 2 required positional arguments 不易查明的继承错误
- 2021 CCPC 哈尔滨 I. Power and Zero(二进制 + 思维)
- Day24: file system
- Minidom module writes and parses XML
- Gobang go to work fishing tools can be LAN / man-machine
- 【C語言】符號的深度理解
- 股票开户佣金最低多少,炒股开户佣金最低网上开户安全吗
- Jerry added the process of turning off the touch module before turning it off [chapter]
- 如何使用ConcurrentLinkedQueue做一个缓存队列
- 吐槽 B 站收费,是怪它没钱么?
猜你喜欢
华为ensp模拟器 DNS服务器的配置
偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
Routing configuration and connectivity test of Huawei simulator ENSP
【公开课预告】:视频质量评价基础与实践
Configuration of DNS server of Huawei ENSP simulator
Word文档中标题前面的黑点如何去掉
[ 每周译Go ] 《How to Code in Go》系列文章上线了!!
Huawei ENSP simulator configures ACL access control list
数十亿公民信息遭泄漏!公有云上的数据安全还有“救”吗?
Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation
随机推荐
2021 CCPC Harbin B. magical subsequence (thinking question)
Jerry's ad series MIDI function description [chapter]
解读创客教育中的各类智能化组织发展
[buuctf.reverse] 151_ [FlareOn6]DnsChess
colResizable.js自动调整表格宽度插件
Google colab踩坑
Foxit pdf editor v10.1.8 green version
Test case (TC)
__ init__ () missing 2 required positive arguments
Huawei ENSP simulator enables devices of multiple routers to access each other
华为ensp模拟器 配置ACL访问控制列表
宝塔 7.9.2 宝塔控制面板绕过 手机绑定认证 绕过官方认证
Methods of improving machine vision system
Day24: file system
redis管道
【C语言】符号的深度理解
heatmap.js图片热点热力图插件
Procurement in software development
Introduction to pressure measurement of JMeter
Billions of citizens' information has been leaked! Is there any "rescue" for data security on the public cloud?