浏览代码

添加安卓保存权限

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


正在加载...
取消
保存