Browse Source

添加安卓保存权限

tags/0.0.1
Weller 4 years ago
parent
commit
98cf893979
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      lib/pages/goods_share_page/goods_share_image/goods_share_image.dart

+ 11
- 0
lib/pages/goods_share_page/goods_share_image/goods_share_image.dart View File

@@ -279,6 +279,17 @@ class _GoodsShareImageState extends State<GoodsShareImage>
return null; 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; bool isSaveSuccess = false;
if (_shareModel.poster != null) { if (_shareModel.poster != null) {
isSaveSuccess = await SaveImage.save(imageBytes: _shareModel.poster); isSaveSuccess = await SaveImage.save(imageBytes: _shareModel.poster);


Loading…
Cancel
Save