From 98cf8939791d5e614274028b70711d3f72811471 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Wed, 14 Oct 2020 09:24:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=89=E5=8D=93=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods_share_image/goods_share_image.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart b/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart index 26ae271..36ba3a0 100644 --- a/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart +++ b/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart @@ -279,6 +279,17 @@ class _GoodsShareImageState extends State return null; } + // 检查并请求权限 + status = await Permission.storage.status; + if (status != PermissionStatus.granted) { + status = await Permission.storage.request(); + } + if (status == PermissionStatus.denied) { + Fluttertoast.showToast(msg: '暂无权限,分享失败'); + return null; + } + + bool isSaveSuccess = false; if (_shareModel.poster != null) { isSaveSuccess = await SaveImage.save(imageBytes: _shareModel.poster);