调整权限和库

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,11 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<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" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
@@ -19,17 +22,18 @@
<application
android:label="小羚羚"
android:requestLegacyExternalStorage="true"
android:name="${applicationName}"
android:icon="@mipmap/logo">
android:icon="@mipmap/logo"
android:label="小羚羚">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
@@ -37,8 +41,7 @@
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -51,31 +54,54 @@
android:value="2" />
<!-- 请填写你自己的- appKey -->
<meta-data android:name="com.alibaba.app.appkey" android:value="335642645"/>
<meta-data
android:name="com.alibaba.app.appkey"
android:value="335642645" />
<!-- 请填写你自己的appSecret -->
<meta-data android:name="com.alibaba.app.appsecret" android:value="39628204345a4240b5b645b68a5896c7"/>
<meta-data
android:name="com.alibaba.app.appsecret"
android:value="39628204345a4240b5b645b68a5896c7" />
<!-- 华为通道的参数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 -->
<meta-data android:name="com.vivo.push.api_key" android:value="" />
<meta-data android:name="com.vivo.push.app_id" android:value="" />
<meta-data
android:name="com.vivo.push.api_key"
android:value="" />
<meta-data
android:name="com.vivo.push.app_id"
android:value="" />
<!-- honor通道的参数-->
<meta-data android:name="com.hihonor.push.app_id" android:value="" />
<meta-data
android:name="com.hihonor.push.app_id"
android:value="" />
<!-- oppo -->
<meta-data android:name="com.oppo.push.key" android:value="" />
<meta-data android:name="com.oppo.push.secret" android:value="" />
<meta-data
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 android:name="com.xiaomi.push.key" android:value="id=5555555555555" />
<meta-data
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 android:name="com.meizu.push.key" android:value="" />
<meta-data
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">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

View File

@@ -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

View File

@@ -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<void> 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<String> 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',

View File

@@ -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:

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
# 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: