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);