当前位置:网站首页>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);
},
),
);
边栏推荐
- minidom 模块写入和解析 XML
- MP3是如何诞生的?
- WGCNA analysis basic tutorial summary
- IIC (STM32)
- 巅峰不止,继续奋斗!城链科技数字峰会于重庆隆重举行
- Difference between ApplicationContext and beanfactory (MS)
- Redis bloom filter
- redis RDB AOF
- Actual combat simulation │ JWT login authentication
- Solution of 5g unstable 5g signal often dropped in NetWare r7000 Merlin system
猜你喜欢

Detailed explanation of multi-mode input event distribution mechanism

WGCNA analysis basic tutorial summary
![Compréhension approfondie du symbole [langue C]](/img/4b/26cf10baa29eeff08101dcbbb673a2.png)
Compréhension approfondie du symbole [langue C]

【活动早知道】LiveVideoStack近期活动一览

华为ensp模拟器 实现多个路由器的设备可以相互访问

c语言函数形参自增自减情况分析

heatmap.js图片热点热力图插件

Huawei ENSP simulator configures ACL access control list

华为ensp模拟器实现通信安全(交换机)

杰理之增加进关机前把触摸模块关闭流程【篇】
随机推荐
[Shenbo introduction] VI How to contact your favorite doctoral tutor
Redis:Redis配置文件相关配置、Redis的持久化
【微信小程序】协同工作与发布
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
maya灯建模
redis RDB AOF
【LeetCode】17、电话号码的字母组合
华为ensp模拟器 三层交换机
WGCNA分析基本教程总结
minidom 模塊寫入和解析 XML
【C语言】符号的深度理解
Actual combat simulation │ JWT login authentication
Roast B station charges, is it because it has no money?
numpy vstack 和 column_stack
华为模拟器ensp常用命令
Jerry's ad series MIDI function description [chapter]
Huawei ENSP simulator layer 3 switch
torch.tensor和torch.Tensor的区别
Gobang go to work fishing tools can be LAN / man-machine
IIC (STM32)