fix(upload_image): 优化临时文件删除逻辑及提示文本显示
- 仅在jpg文件类型时删除临时文件,防止误删其他文件类型 - 修正上传图片提示中相册最大数量变量显示问题,提升用户体验
This commit is contained in:
@@ -77,8 +77,10 @@ class UploadOss {
|
|||||||
);
|
);
|
||||||
print("response ===== $response");
|
print("response ===== $response");
|
||||||
EasyLoading.dismiss();
|
EasyLoading.dismiss();
|
||||||
|
if(fileType == 'jpg'){
|
||||||
/// 删除临时文件
|
/// 删除临时文件
|
||||||
File(path).deleteSync();
|
File(path).deleteSync();
|
||||||
|
}
|
||||||
// 成功后返回文件访问路径
|
// 成功后返回文件访问路径
|
||||||
return "$ossHost/$ossDirectory$pathName";
|
return "$ossHost/$ossDirectory$pathName";
|
||||||
} on DioError catch (e) {
|
} on DioError catch (e) {
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class _UploadImagesState extends State<UploadImages> {
|
|||||||
title: const Text('上传图片'),
|
title: const Text('上传图片'),
|
||||||
message: (max == null || max == 0)
|
message: (max == null || max == 0)
|
||||||
? null
|
? null
|
||||||
: Text('请选择上传方式\n相册最多${max ?? 9}张'),
|
: Text('请选择上传方式\n相册最多$max张'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CupertinoActionSheetAction(
|
CupertinoActionSheetAction(
|
||||||
child: const Text('拍照上传'),
|
child: const Text('拍照上传'),
|
||||||
|
|||||||
Reference in New Issue
Block a user