浏览代码

Display error dialog if permission is rejected

Vishnu Mohandas 4 年之前
父节点
当前提交
f1a1a320c1
共有 1 个文件被更改,包括 28 次插入2 次删除
  1. 28 2
      lib/ui/grant_permissions_widget.dart

+ 28 - 2
lib/ui/grant_permissions_widget.dart

@@ -57,8 +57,34 @@ class GrantPermissionsWidget extends StatelessWidget {
                     state == PermissionState.limited) {
                   await SyncService.instance.onPermissionGranted(state);
                 } else if (state == PermissionState.denied) {
-                  showToast("please grant permissions to access the gallery");
-                  PhotoManager.openSetting();
+                  AlertDialog alert = AlertDialog(
+                    title: Text("please grant permissions"),
+                    content: Text(
+                        "ente can encrypt and preserve files only if you grant access to them"),
+                    actions: [
+                      TextButton(
+                        child: Text(
+                          "ok",
+                          style: TextStyle(
+                            color: Theme.of(context).buttonColor,
+                          ),
+                        ),
+                        onPressed: () {
+                          Navigator.of(context, rootNavigator: true)
+                              .pop('dialog');
+                          PhotoManager.openSetting();
+                        },
+                      ),
+                    ],
+                  );
+
+                  showDialog(
+                    context: context,
+                    builder: (BuildContext context) {
+                      return alert;
+                    },
+                    barrierColor: Colors.black87,
+                  );
                 }
               },
             ),