更新
This commit is contained in:
@@ -106,8 +106,10 @@ class PickerService {
|
||||
return image == null ? null : [image];
|
||||
}
|
||||
// 相册权限:Android 13+ 用 photos (READ_MEDIA_IMAGES),旧版用 storage
|
||||
final galleryPermission = await _resolveGalleryPermission();
|
||||
if (!context.mounted) return null;
|
||||
final ok = await _ensurePermission(
|
||||
permission: await _resolveGalleryPermission(),
|
||||
permission: galleryPermission,
|
||||
title: '需要相册权限',
|
||||
purpose: '从相册选取图片用于上传错题、作业图片及更换头像',
|
||||
context: context,
|
||||
@@ -190,10 +192,10 @@ class PickerService {
|
||||
// 不再强制锁拍照方向。题目/解答/讲义拍摄经常需要横拍,
|
||||
// 后续交给 ImageProcessor 的原生压缩链做 autoCorrectionAngle。
|
||||
onEntitySaving: (dialogContext, viewType, file) async {
|
||||
final xFile = XFile(file.path);
|
||||
// 只持有文件路径,不 readAsBytes:原图字节不进 Dart 堆,
|
||||
// 后续压缩由原生侧直接读文件(避免大图 OOM)。
|
||||
picked = PickedImage(
|
||||
path: file.path,
|
||||
bytes: await xFile.readAsBytes(),
|
||||
name: file.path.split('/').last,
|
||||
);
|
||||
if (dialogContext.mounted) {
|
||||
|
||||
Reference in New Issue
Block a user