Commit 1e84eaed484439dc4f52f9cf5a9a3da3d215f866

Authored by wdn127929
1 parent b40782f2

修复权限使用目的提醒bug:用户自主按返回键遮罩层消失,定时器还会执行返回上一层页面,当用户在home页,即栈顶层,则会出现黑屏

Showing 1 changed file with 11 additions and 6 deletions
  1 +import 'dart:async';
1 import 'dart:convert'; 2 import 'dart:convert';
2 import 'dart:ui'; 3 import 'dart:ui';
3 4
@@ -60,15 +61,15 @@ typedef ClickCallback = void Function(String value); @@ -60,15 +61,15 @@ typedef ClickCallback = void Function(String value);
60 61
61 class DialogUtil { 62 class DialogUtil {
62 static showAuthorityDestination( 63 static showAuthorityDestination(
63 - BuildContext context, String name, String title, String subTitle) {  
64 - Future.delayed(const Duration(seconds: 5), () { 64 + BuildContext context, String name, String title, String subTitle) async {
  65 +
  66 + Timer _timer = Timer(const Duration(seconds: 5), () {
65 Navigator.of(context).pop(true); 67 Navigator.of(context).pop(true);
66 }); 68 });
67 - return showDialog( 69 + final action = await showDialog(
68 context: context, 70 context: context,
69 barrierDismissible: true, 71 barrierDismissible: true,
70 - anchorPoint:Offset(0,0),  
71 - 72 + anchorPoint: Offset(0, 0),
72 builder: (BuildContext context) { 73 builder: (BuildContext context) {
73 return StatefulBuilder(builder: (context, state) { 74 return StatefulBuilder(builder: (context, state) {
74 // locationState = state; 75 // locationState = state;
@@ -114,9 +115,13 @@ class DialogUtil { @@ -114,9 +115,13 @@ class DialogUtil {
114 }); 115 });
115 }); 116 });
116 117
117 - ; 118 + print(action);
  119 + _timer.cancel();
  120 +
  121 + return action;
118 } 122 }
119 123
  124 +
120 //模块快过期提醒 125 //模块快过期提醒
121 static showSellerVersionEdateDialog(BuildContext context, 126 static showSellerVersionEdateDialog(BuildContext context,
122 List<SellerVersionSunModel> showData, CustomCallBack callback, 127 List<SellerVersionSunModel> showData, CustomCallBack callback,