瀏覽代碼

添加安卓保存权限

tags/0.0.1
Weller 4 年之前
父節點
當前提交
98cf893979
共有 1 個文件被更改,包括 11 次插入0 次删除
  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 查看文件

@@ -279,6 +279,17 @@ class _GoodsShareImageState extends State<GoodsShareImage>
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);


Loading…
取消
儲存