更新ui
This commit is contained in:
@@ -4,6 +4,8 @@ import 'dart:io';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
@@ -12,6 +14,7 @@ import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||
import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/MattressControl.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page.dart';
|
||||
@@ -122,8 +125,30 @@ class _HomePageState extends State<MainPageBBottomChange>
|
||||
}
|
||||
|
||||
DateTime? _lastBackPressedTime; // 记录上一次返回的时间
|
||||
final getStorage = GetStorage();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Future.delayed(const Duration(milliseconds: 0), () {
|
||||
// String? isShowYingShiDialog = getStorage.read("isShowYingShiDialog");
|
||||
// if (isShowYingShiDialog == null || isShowYingShiDialog != "true") {
|
||||
// String btnName = "同意".tr;
|
||||
// String cancelName = "取消".tr;
|
||||
// if (Platform.isAndroid) {
|
||||
// cancelName = "退出".tr;
|
||||
// }
|
||||
// showCustomConfirmOfWebViewDialog(context, "隐私协议".tr, getPrivacy(1),
|
||||
// btnName: btnName, showCancel: true, cancelName: cancelName)
|
||||
// .then((e) {
|
||||
// if (e == "confirm") {
|
||||
// getStorage.write("isShowYingShiDialog", "true");
|
||||
// } else {
|
||||
// if (cancelName == "退出") {
|
||||
// SystemNavigator.pop();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
return Obx(() {
|
||||
final currentLanguage =
|
||||
languageController.selectLanguage.value; // 监听此变量变化
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
@@ -14,6 +15,7 @@ import 'package:vbvs_app/controller/message/message_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/enum/LoginStatus.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/e_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/home_page.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/message_page.dart';
|
||||
@@ -75,16 +77,56 @@ class MainPageBottomChange extends GetView<MainPageController> {
|
||||
];
|
||||
|
||||
DateTime? _lastBackPressedTime; // 记录上一次返回的时间
|
||||
final getStorage = GetStorage();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Future.delayed(const Duration(milliseconds: 0), () {
|
||||
String? isShowYingShiDialog = getStorage.read("isShowYingShiDialog");
|
||||
if (isShowYingShiDialog == null || isShowYingShiDialog != "true") {
|
||||
String btnName = "同意".tr;
|
||||
String cancelName = "取消".tr;
|
||||
if (Platform.isAndroid) {
|
||||
cancelName = "退出".tr;
|
||||
}
|
||||
showCustomConfirmOfWebViewDialog(context, "隐私协议".tr, getPrivacy(1),
|
||||
btnName: btnName, showCancel: true, cancelName: cancelName)
|
||||
.then((e) {
|
||||
if (e == "confirm") {
|
||||
getStorage.write("isShowYingShiDialog", "true");
|
||||
} else {
|
||||
if (cancelName == "退出") {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
|
||||
// onPopInvokedWithResult: (disposition, result) async {
|
||||
// if (Platform.isAndroid) {
|
||||
// var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
// if (flag) {
|
||||
// SystemNavigator.pop();
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
onPopInvokedWithResult: (disposition, result) async {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
if (userInfoController.model.isProgrammaticPop) {
|
||||
// 如果是程序触发,重置标记并忽略
|
||||
userInfoController.model.isProgrammaticPop = false;
|
||||
return; // 阻止处理
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
if (flag) {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
// var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
// if (flag) {
|
||||
// SystemNavigator.pop();
|
||||
// }
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
child: Obx(
|
||||
@@ -170,7 +212,6 @@ class MainPageBottomChange extends GetView<MainPageController> {
|
||||
controller.updateAll();
|
||||
});
|
||||
},
|
||||
|
||||
items: [
|
||||
getBottomNavigationBarItem("assets/img/menu/home.svg",
|
||||
"assets/img/menu/n_home.svg", "菜单.首页".tr),
|
||||
|
||||
Reference in New Issue
Block a user