release
This commit is contained in:
@@ -12,6 +12,7 @@ import '../../controllers/history_controller.dart';
|
||||
import '../../controllers/shared_preferences_storage_controller.dart';
|
||||
import '../isweb/wakelock_service.dart';
|
||||
import '../../views/profile/guide/tongji.dart';
|
||||
import 'theme_controller.dart';
|
||||
|
||||
class ProfileController extends GetxController with WidgetsBindingObserver {
|
||||
// 页面状态
|
||||
@@ -214,9 +215,14 @@ class ProfileController extends GetxController with WidgetsBindingObserver {
|
||||
|
||||
// === 屏幕常亮相关方法 ===
|
||||
Future<void> toggleScreenWake(bool enable) async {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
// Web 平台不支持 wakelock_plus
|
||||
if (kIsWeb) {
|
||||
Get.snackbar('提示', 'Web 平台不支持屏幕常亮功能');
|
||||
Get.snackbar(
|
||||
'提示',
|
||||
'Web 平台不支持屏幕常亮功能',
|
||||
colorText: themeController.currentThemeColor,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,10 +234,18 @@ class ProfileController extends GetxController with WidgetsBindingObserver {
|
||||
|
||||
if (enable) {
|
||||
await WakelockService.instance.enable();
|
||||
Get.snackbar('提示', '屏幕常亮已开启');
|
||||
Get.snackbar(
|
||||
'提示',
|
||||
'屏幕常亮已开启',
|
||||
colorText: themeController.currentThemeColor,
|
||||
);
|
||||
} else {
|
||||
await WakelockService.instance.disable();
|
||||
Get.snackbar('提示', '屏幕常亮已关闭');
|
||||
Get.snackbar(
|
||||
'提示',
|
||||
'屏幕常亮已关闭',
|
||||
colorText: themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
|
||||
// 不再更新开关状态,由 UI 层直接控制
|
||||
@@ -324,6 +338,7 @@ class ProfileController extends GetxController with WidgetsBindingObserver {
|
||||
|
||||
// === 显示提示 ===
|
||||
void showSnackBar(String message) {
|
||||
Get.snackbar('提示', message);
|
||||
final themeController = Get.find<ThemeController>();
|
||||
Get.snackbar('提示', message, colorText: themeController.currentThemeColor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user