Merge branch 'main' of http://192.168.3.16:3800/lxh2875931338/MEIZU-Battery-Healthy
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../models/device_matching.dart';
|
||||
import '../utils/charge_utils.dart';
|
||||
@@ -250,6 +251,10 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
|
||||
|
||||
// ---------- SAF 授权引导 ----------
|
||||
void _showSafAuthorizationDialog() {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 避免重复弹窗
|
||||
>>>>>>> c5a85e05a3bb50cd4ea7de0da2db94c867eb7ddd
|
||||
if (!mounted) return;
|
||||
|
||||
showDialog(
|
||||
@@ -275,6 +280,10 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 用户取消后,保持当前状态,但不阻塞后续操作
|
||||
>>>>>>> c5a85e05a3bb50cd4ea7de0da2db94c867eb7ddd
|
||||
setState(() {
|
||||
_safState = SafPermissionState.denied;
|
||||
});
|
||||
@@ -283,11 +292,19 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
<<<<<<< HEAD
|
||||
final ctx = context;
|
||||
Navigator.pop(ctx);
|
||||
final result = await _safService.requestPermission();
|
||||
if (result.success) {
|
||||
if (!mounted) return;
|
||||
=======
|
||||
final ctx = context; // 保存引用
|
||||
Navigator.pop(ctx);
|
||||
final result = await _safService.requestPermission();
|
||||
if (result.success) {
|
||||
if (!mounted) return; // 先检查 State 是否还在
|
||||
>>>>>>> c5a85e05a3bb50cd4ea7de0da2db94c867eb7ddd
|
||||
setState(() {
|
||||
_safState = SafPermissionState.authorized;
|
||||
});
|
||||
@@ -300,10 +317,17 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
_showSafAuthorizationDialog();
|
||||
}
|
||||
},
|
||||
child: const Text('选择文件夹'), // 🟢 加这行
|
||||
=======
|
||||
// 重新弹窗
|
||||
_showSafAuthorizationDialog();
|
||||
}
|
||||
},
|
||||
>>>>>>> c5a85e05a3bb50cd4ea7de0da2db94c867eb7ddd
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user