Commit a7b16fa1c4f699a046c93aa57e65bcc9238a7ba5

Authored by wdn127929
1 parent aa3cbc24

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

@@ -268,7 +268,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -268,7 +268,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
268 if (widget.initialIndex == 0 || 268 if (widget.initialIndex == 0 ||
269 widget.initialIndex == 1 && needRefreshTemp == false) return; 269 widget.initialIndex == 1 && needRefreshTemp == false) return;
270 _initNotification(); 270 _initNotification();
271 - Future.delayed(Duration(minutes: 5), () { 271 + Future.delayed(Duration(seconds: 5), () {
272 //30000 272 //30000
273 ContactModel.getInstance().uploadLocalContact(context); 273 ContactModel.getInstance().uploadLocalContact(context);
274 UserModel usermodel = Provider.of<UserModel>(context, listen: false); 274 UserModel usermodel = Provider.of<UserModel>(context, listen: false);
  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,14 @@ typedef ClickCallback = void Function(String value); @@ -60,15 +61,14 @@ 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 + Timer _timer = Timer(const Duration(seconds: 5), () {
65 Navigator.of(context).pop(true); 66 Navigator.of(context).pop(true);
66 }); 67 });
67 - return showDialog( 68 + final action = await showDialog(
68 context: context, 69 context: context,
69 barrierDismissible: true, 70 barrierDismissible: true,
70 - anchorPoint:Offset(0,0),  
71 - 71 + anchorPoint: Offset(0, 0),
72 builder: (BuildContext context) { 72 builder: (BuildContext context) {
73 return StatefulBuilder(builder: (context, state) { 73 return StatefulBuilder(builder: (context, state) {
74 // locationState = state; 74 // locationState = state;
@@ -114,7 +114,10 @@ class DialogUtil { @@ -114,7 +114,10 @@ class DialogUtil {
114 }); 114 });
115 }); 115 });
116 116
117 - ; 117 + print(action);
  118 + _timer.cancel();
  119 +
  120 + return action;
118 } 121 }
119 122
120 //模块快过期提醒 123 //模块快过期提醒