调整权限和库

This commit is contained in:
2026-03-02 11:28:44 +08:00
parent a26d2478f3
commit 6997b4ac9e
5 changed files with 93 additions and 52 deletions

View File

@@ -1,35 +1,39 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" <uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" /> android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" /> android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" <uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" /> android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<!--定位权限--> <!--定位权限-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application <application
android:label="小羚羚" android:requestLegacyExternalStorage="true"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/logo"> android:icon="@mipmap/logo"
android:label="小羚羚">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true" android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:taskAffinity="" android:taskAffinity=""
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
@@ -37,11 +41,10 @@
to determine the Window background behind the Flutter UI. --> to determine the Window background behind the Flutter UI. -->
<meta-data <meta-data
android:name="io.flutter.embedding.android.NormalTheme" android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" android:resource="@style/NormalTheme" />
/>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
@@ -51,31 +54,54 @@
android:value="2" /> android:value="2" />
<!-- 请填写你自己的- appKey --> <!-- 请填写你自己的- appKey -->
<meta-data android:name="com.alibaba.app.appkey" android:value="335642645"/> <meta-data
android:name="com.alibaba.app.appkey"
android:value="335642645" />
<!-- 请填写你自己的appSecret --> <!-- 请填写你自己的appSecret -->
<meta-data android:name="com.alibaba.app.appsecret" android:value="39628204345a4240b5b645b68a5896c7"/> <meta-data
android:name="com.alibaba.app.appsecret"
android:value="39628204345a4240b5b645b68a5896c7" />
<!-- 华为通道的参数appid --> <!-- 华为通道的参数appid -->
<meta-data android:name="com.huawei.hms.client.appid" android:value="" /> <meta-data
android:name="com.huawei.hms.client.appid"
android:value="" />
<!-- vivo通道的参数api_key为appkey --> <!-- vivo通道的参数api_key为appkey -->
<meta-data android:name="com.vivo.push.api_key" android:value="" /> <meta-data
<meta-data android:name="com.vivo.push.app_id" android:value="" /> android:name="com.vivo.push.api_key"
android:value="" />
<meta-data
android:name="com.vivo.push.app_id"
android:value="" />
<!-- honor通道的参数--> <!-- honor通道的参数-->
<meta-data android:name="com.hihonor.push.app_id" android:value="" /> <meta-data
android:name="com.hihonor.push.app_id"
android:value="" />
<!-- oppo --> <!-- oppo -->
<meta-data android:name="com.oppo.push.key" android:value="" /> <meta-data
<meta-data android:name="com.oppo.push.secret" android:value="" /> android:name="com.oppo.push.key"
android:value="" />
<meta-data
android:name="com.oppo.push.secret"
android:value="" />
<!-- 小米--> <!-- 小米-->
<meta-data android:name="com.xiaomi.push.id" android:value="id=2222222222222222222" /> <meta-data
<meta-data android:name="com.xiaomi.push.key" android:value="id=5555555555555" /> android:name="com.xiaomi.push.id"
android:value="id=2222222222222222222" />
<meta-data
android:name="com.xiaomi.push.key"
android:value="id=5555555555555" />
<!-- 魅族--> <!-- 魅族-->
<meta-data android:name="com.meizu.push.id" android:value="" /> <meta-data
<meta-data android:name="com.meizu.push.key" android:value="" /> android:name="com.meizu.push.id"
android:value="" />
<meta-data
android:name="com.meizu.push.key"
android:value="" />
<!-- 接收推送消息 --> <!-- 接收推送消息 -->
@@ -99,6 +125,7 @@
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
@@ -117,8 +144,8 @@
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries> <queries>
<intent> <intent>
<action android:name="android.intent.action.PROCESS_TEXT"/> <action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain" />
</intent> </intent>
</queries> </queries>
</manifest> </manifest>

View File

@@ -28,6 +28,8 @@ PODS:
- geolocator_apple (1.2.0): - geolocator_apple (1.2.0):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- image_gallery_saver (2.0.2):
- Flutter
- image_picker_ios (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- mobile_scanner (7.0.0): - mobile_scanner (7.0.0):
@@ -57,6 +59,7 @@ DEPENDENCIES:
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_pdfview (from `.symlinks/plugins/flutter_pdfview/ios`) - flutter_pdfview (from `.symlinks/plugins/flutter_pdfview/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`) - 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`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`) - mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
@@ -93,6 +96,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_pdfview/ios" :path: ".symlinks/plugins/flutter_pdfview/ios"
geolocator_apple: geolocator_apple:
:path: ".symlinks/plugins/geolocator_apple/darwin" :path: ".symlinks/plugins/geolocator_apple/darwin"
image_gallery_saver:
:path: ".symlinks/plugins/image_gallery_saver/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
mobile_scanner: mobile_scanner:
@@ -121,6 +126,7 @@ SPEC CHECKSUMS:
flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf
flutter_pdfview: 32bf27bda6fd85b9dd2c09628a824df5081246cf flutter_pdfview: 32bf27bda6fd85b9dd2c09628a824df5081246cf
geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e
image_gallery_saver: 14711d79da40581063e8842a11acf1969d781ed7
image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326 image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326
mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93 mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94

View File

@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:getx_scaffold/getx_scaffold.dart' as dio; import 'package:getx_scaffold/getx_scaffold.dart' as dio;
import 'package:getx_scaffold/getx_scaffold.dart'; 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:image_picker/image_picker.dart';
import 'package:ln_jq_app/common/model/base_model.dart'; import 'package:ln_jq_app/common/model/base_model.dart';
import 'package:ln_jq_app/common/styles/theme.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.dart';
import 'package:photo_view/photo_view_gallery.dart'; import 'package:photo_view/photo_view_gallery.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:saver_gallery/saver_gallery.dart';
enum ReservationStatus { enum ReservationStatus {
pending, // 待处理 ( addStatus: 0) pending, // 待处理 ( addStatus: 0)
@@ -796,10 +796,20 @@ class SiteController extends GetxController with BaseControllerMixin {
/// 保存图片到相册 /// 保存图片到相册
Future<void> saveImageToLocal(String url) async { Future<void> saveImageToLocal(String url) async {
try {
// 1. 权限请求 // 1. 权限请求
if (Platform.isAndroid) { 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) { if (!status.isGranted) {
showErrorToast("请在系统设置中开启存储权限"); showErrorToast("请在系统设置中开启存储权限");
return; return;
@@ -821,23 +831,21 @@ class SiteController extends GetxController with BaseControllerMixin {
); );
// 3. 保存到相册 // 3. 保存到相册
final result = await ImageGallerySaver.saveImage( final result = await SaverGallery.saveImage(
Uint8List.fromList(response.data), Uint8List.fromList(response.data),
quality: 100, quality: 100,
name: "certificate_${DateTime.now().millisecondsSinceEpoch}", fileName: "certificate_${DateTime.now().millisecondsSinceEpoch}",
skipIfExists: false,
); );
dismissLoading(); dismissLoading();
if (result != null && result['isSuccess'] == true) { if (result.isSuccess) {
showSuccessToast("图片已保存至相册"); showSuccessToast("图片已保存至相册");
} else { } else {
showErrorToast("保存失败"); showErrorToast("保存失败");
} }
} catch (e) {
dismissLoading();
showErrorToast("保存异常");
}
} }
Widget buildInfoTag(String label, List<String> images) { Widget buildInfoTag(String label, List<String> images) {
@@ -1105,7 +1113,7 @@ class SiteController extends GetxController with BaseControllerMixin {
showLoading("确认中"); showLoading("确认中");
try { try {
var responseData; dio.Response? responseData;
if (isAdd) { if (isAdd) {
responseData = await HttpService.to.post( responseData = await HttpService.to.post(
'appointment/orderAddHyd/addOfflineOrder', 'appointment/orderAddHyd/addOfflineOrder',

View File

@@ -589,14 +589,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.7.2" 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: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -965,6 +957,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.2.3" 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: shared_preferences:
dependency: transitive dependency: transitive
description: description:

View File

@@ -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 # 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 # 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. # 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: environment:
sdk: ^3.9.0 sdk: ^3.9.0
@@ -53,7 +53,7 @@ dependencies:
aliyun_push_flutter: ^1.3.6 aliyun_push_flutter: ^1.3.6
pull_to_refresh: ^2.0.0 pull_to_refresh: ^2.0.0
flutter_app_update: ^3.2.2 flutter_app_update: ^3.2.2
image_gallery_saver: ^2.0.3 saver_gallery: ^4.0.0
dev_dependencies: dev_dependencies: