当前位置:网站首页>Monitor the shuttle return button
Monitor the shuttle return button
2022-07-04 21:32:00 【Boundless 6688】
Monitoring of physical buttons and return buttons
Flutter The return button is monitored through WillPopScope To achieve
class BackDemoState extends State<BackDemoWidget> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onWillPop,
child: Scaffold(
appBar: AppBar(
title: const Text(" Back key monitor "),
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: (){
SmartDialog.showToast(" return ");
if (Navigator.canPop(context)) {
Navigator.pop(context);
} else {
SystemNavigator.pop();
}
},
),
),
));
}
Future<bool> _onWillPop() {
SmartDialog.showToast(" return ");
if (Navigator.canPop(context)) {
Navigator.pop(context);
} else {
SystemNavigator.pop();
}
return Future.value(false);
}
}
WebView Return listening of
@override
Widget build(BuildContext context) {
return FutureBuilder<WebViewController>(
future: _controller.future,
builder: (context, snapshot) {
return WillPopScope(
onWillPop: () async {
if (snapshot.hasData) {
final bool canGoBack = await snapshot.data!.canGoBack();
if (canGoBack) {
// When a web page can be returned , Return to the previous page first
await snapshot.data!.goBack();
return Future.value(false);
}
}
return Future.value(true);
},
child: Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
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,
],
),
),
);
}
);
}
边栏推荐
- OMS系统实战的三两事
- Maidong Internet won the bid of Beijing life insurance
- Can be displayed in CAD but not displayed in print
- redis缓存
- Hwinfo hardware detection tool v7.26 green version
- Test case (TC)
- Day24:文件系统
- 偷窃他人漏洞报告变卖成副业,漏洞赏金平台出“内鬼”
- Jerry's ad series MIDI function description [chapter]
- Roast B station charges, is it because it has no money?
猜你喜欢

Huawei ENSP simulator layer 3 switch

Y56. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (29)

华为ensp模拟器 配置ACL访问控制列表

数十亿公民信息遭泄漏!公有云上的数据安全还有“救”吗?

JS卡牌样式倒计时天数

shp数据制作3DTiles白膜

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

torch. Tensor and torch The difference between tensor

Redis:Redis配置文件相关配置、Redis的持久化

Configuration of DNS server of Huawei ENSP simulator
随机推荐
Maya lamp modeling
Routing configuration and connectivity test of Huawei simulator ENSP
【optimtool.unconstrain】无约束优化工具箱
SolidWorks工程图添加材料明细表的操作
The video sound of station B is very low - solution
__init__() missing 2 required positional arguments 不易查明的继承错误
Procurement in software development
A quick start to fastdfs takes you three minutes to upload and download files to the ECS
D3.js+Three.js数据可视化3d地球js特效
Methods of improving machine vision system
每日一题-LeetCode556-下一个更大元素III-字符串-双指针-next_permutation
Foxit pdf editor v10.1.8 green version
杰理之AD 系列 MIDI 功能说明【篇】
Why does invariant mode improve performance
【活动早知道】LiveVideoStack近期活动一览
[solution] paddlepaddle 2 X call static graph mode
MYSQL 用!=查询不出等于null的数据,解决办法
torch. Tensor and torch The difference between tensor
[C language] deep understanding of symbols
Poster cover of glacier