当前位置:网站首页>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);
},
),
);
边栏推荐
- 宝塔 7.9.2 宝塔控制面板绕过 手机绑定认证 绕过官方认证
- Le module minidom écrit et analyse XML
- 巅峰不止,继续奋斗!城链科技数字峰会于重庆隆重举行
- Kubeadm初始化报错:[ERROR CRI]: container runtime is not running
- torch. Tensor and torch The difference between tensor
- JS卡牌样式倒计时天数
- [public class preview]: basis and practice of video quality evaluation
- Redis cache
- redis发布订阅的使用
- Jerry added the process of turning off the touch module before turning it off [chapter]
猜你喜欢
杰理之增加进关机前把触摸模块关闭流程【篇】
多模輸入事件分發機制詳解
What are the functional modules of RFID warehouse management system solution
colResizable.js自动调整表格宽度插件
y56.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(二九)
Arcgis 10.2.2 | arcgis license server无法启动的解决办法
Can be displayed in CAD but not displayed in print
Day24: file system
搭建一个仪式感点满的网站,并内网穿透发布到公网 1/2
Jerry's ad series MIDI function description [chapter]
随机推荐
Flutter TextField示例
shp数据制作3DTiles白膜
torch.tensor和torch.Tensor的区别
SolidWorks工程图添加材料明细表的操作
Huawei ENSP simulator realizes communication security (switch)
华为ensp模拟器 配置ACL访问控制列表
Maya lamp modeling
类方法和类变量的使用
Redis cache
MP3是如何诞生的?
Gobang go to work fishing tools can be LAN / man-machine
[ 每周译Go ] 《How to Code in Go》系列文章上线了!!
[buuctf.reverse] 151_ [FlareOn6]DnsChess
2021 CCPC 哈尔滨 I. Power and Zero(二进制 + 思维)
__ init__ () missing 2 required positive arguments
EhLib 数据库记录的下拉选择
torch. Tensor and torch The difference between tensor
Day24: file system
Roast B station charges, is it because it has no money?
华为ensp模拟器 实现多个路由器的设备可以相互访问