This commit is contained in:
chenshuainan
2026-09-28 20:12:34 +08:00
parent 847986f861
commit 5f53bd8f94
60 changed files with 14624 additions and 398 deletions
+5 -3
View File
@@ -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) {