From 6997b4ac9ef7cb3d9f0849cffcc01c94474ea271 Mon Sep 17 00:00:00 2001 From: userGyl Date: Mon, 2 Mar 2026 11:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9D=83=E9=99=90=E5=92=8C?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/app/src/main/AndroidManifest.xml | 89 ++++++++++++------- ln_jq_app/ios/Podfile.lock | 6 ++ .../lib/pages/b_page/site/controller.dart | 30 ++++--- ln_jq_app/pubspec.lock | 16 ++-- ln_jq_app/pubspec.yaml | 4 +- 5 files changed, 93 insertions(+), 52 deletions(-) diff --git a/ln_jq_app/android/app/src/main/AndroidManifest.xml b/ln_jq_app/android/app/src/main/AndroidManifest.xml index 5392736..c23b807 100644 --- a/ln_jq_app/android/app/src/main/AndroidManifest.xml +++ b/ln_jq_app/android/app/src/main/AndroidManifest.xml @@ -1,47 +1,50 @@ - - - - - - - + + + + + android:icon="@mipmap/logo" + android:label="小羚羚"> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" /> - - + + - + - + - + - - + + - + - - + + - - + + - - - + + @@ -99,6 +125,7 @@ android:exported="true"> + @@ -117,8 +144,8 @@ In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> - - + + diff --git a/ln_jq_app/ios/Podfile.lock b/ln_jq_app/ios/Podfile.lock index 20c507a..d86a2bd 100644 --- a/ln_jq_app/ios/Podfile.lock +++ b/ln_jq_app/ios/Podfile.lock @@ -28,6 +28,8 @@ PODS: - geolocator_apple (1.2.0): - Flutter - FlutterMacOS + - image_gallery_saver (2.0.2): + - Flutter - image_picker_ios (0.0.1): - Flutter - mobile_scanner (7.0.0): @@ -57,6 +59,7 @@ DEPENDENCIES: - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - flutter_pdfview (from `.symlinks/plugins/flutter_pdfview/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`) + - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) @@ -93,6 +96,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_pdfview/ios" geolocator_apple: :path: ".symlinks/plugins/geolocator_apple/darwin" + image_gallery_saver: + :path: ".symlinks/plugins/image_gallery_saver/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/ios" mobile_scanner: @@ -121,6 +126,7 @@ SPEC CHECKSUMS: flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf flutter_pdfview: 32bf27bda6fd85b9dd2c09628a824df5081246cf geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e + image_gallery_saver: 14711d79da40581063e8842a11acf1969d781ed7 image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326 mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93 OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 diff --git a/ln_jq_app/lib/pages/b_page/site/controller.dart b/ln_jq_app/lib/pages/b_page/site/controller.dart index e87f903..3d3e838 100644 --- a/ln_jq_app/lib/pages/b_page/site/controller.dart +++ b/ln_jq_app/lib/pages/b_page/site/controller.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:getx_scaffold/getx_scaffold.dart' as dio; import 'package:getx_scaffold/getx_scaffold.dart'; -import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:image_picker/image_picker.dart'; import 'package:ln_jq_app/common/model/base_model.dart'; import 'package:ln_jq_app/common/styles/theme.dart'; @@ -13,6 +12,7 @@ import 'package:ln_jq_app/storage_service.dart'; import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view_gallery.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:saver_gallery/saver_gallery.dart'; enum ReservationStatus { pending, // 待处理 ( addStatus: 0) @@ -796,10 +796,20 @@ class SiteController extends GetxController with BaseControllerMixin { /// 保存图片到相册 Future saveImageToLocal(String url) async { - try { + // 1. 权限请求 if (Platform.isAndroid) { - var status = await Permission.storage.request(); + dio.PermissionStatus status; + + final deviceInfo = await DeviceInfoPlugin().androidInfo; + final sdkInt = deviceInfo.version.sdkInt; + + if (sdkInt <= 32) { + status = await Permission.storage.request(); + } else { + status = await Permission.photos.request(); + } + if (!status.isGranted) { showErrorToast("请在系统设置中开启存储权限"); return; @@ -821,23 +831,21 @@ class SiteController extends GetxController with BaseControllerMixin { ); // 3. 保存到相册 - final result = await ImageGallerySaver.saveImage( + final result = await SaverGallery.saveImage( Uint8List.fromList(response.data), quality: 100, - name: "certificate_${DateTime.now().millisecondsSinceEpoch}", + fileName: "certificate_${DateTime.now().millisecondsSinceEpoch}", + skipIfExists: false, ); dismissLoading(); - if (result != null && result['isSuccess'] == true) { + if (result.isSuccess) { showSuccessToast("图片已保存至相册"); } else { showErrorToast("保存失败"); } - } catch (e) { - dismissLoading(); - showErrorToast("保存异常"); - } + } Widget buildInfoTag(String label, List images) { @@ -1105,7 +1113,7 @@ class SiteController extends GetxController with BaseControllerMixin { showLoading("确认中"); try { - var responseData; + dio.Response? responseData; if (isAdd) { responseData = await HttpService.to.post( 'appointment/orderAddHyd/addOfflineOrder', diff --git a/ln_jq_app/pubspec.lock b/ln_jq_app/pubspec.lock index c6452f9..ed02b5f 100644 --- a/ln_jq_app/pubspec.lock +++ b/ln_jq_app/pubspec.lock @@ -589,14 +589,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.7.2" - image_gallery_saver: - dependency: "direct main" - description: - name: image_gallery_saver - sha256: "0aba74216a4d9b0561510cb968015d56b701ba1bd94aace26aacdd8ae5761816" - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.3" image_picker: dependency: "direct main" description: @@ -965,6 +957,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.2.3" + saver_gallery: + dependency: "direct main" + description: + name: saver_gallery + sha256: "1d942bd7f4fedc162d9a751e156ebac592e4b81fc2e757af82de9077f3437003" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.0" shared_preferences: dependency: transitive description: diff --git a/ln_jq_app/pubspec.yaml b/ln_jq_app/pubspec.yaml index 9aae053..6c575cf 100644 --- a/ln_jq_app/pubspec.yaml +++ b/ln_jq_app/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.2.2+5 +version: 1.2.3+6 environment: sdk: ^3.9.0 @@ -53,7 +53,7 @@ dependencies: aliyun_push_flutter: ^1.3.6 pull_to_refresh: ^2.0.0 flutter_app_update: ^3.2.2 - image_gallery_saver: ^2.0.3 + saver_gallery: ^4.0.0 dev_dependencies: