更新新版控制
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
[
|
[
|
||||||
"assets/miniapp/mhtControl_1.0.89.zip"
|
"assets/miniapp/mhtControl_1.0.90.zip"
|
||||||
]
|
]
|
||||||
@@ -313,8 +313,8 @@
|
|||||||
"开始校准": "Start calibration",
|
"开始校准": "Start calibration",
|
||||||
"校准完成": "Calibration complete!",
|
"校准完成": "Calibration complete!",
|
||||||
"微信安装提示": "Please install WeChat APP first",
|
"微信安装提示": "Please install WeChat APP first",
|
||||||
"安卓启用网络提示": "",
|
"安卓启用网络提示": "The network is not enabled. Please enable the network connection",
|
||||||
"ios启用网络提示": "",
|
"ios启用网络提示": "The network is not enabled. Please enable the network connection",
|
||||||
"设备报修": "Device repair",
|
"设备报修": "Device repair",
|
||||||
"联系人": "Contact",
|
"联系人": "Contact",
|
||||||
"手机号": "Phone",
|
"手机号": "Phone",
|
||||||
@@ -623,5 +623,7 @@
|
|||||||
"注意!关闭后将无法接受任何消息": "Note! After closing, you will not receive any messages",
|
"注意!关闭后将无法接受任何消息": "Note! After closing, you will not receive any messages",
|
||||||
"手机号登录": "Phone Login",
|
"手机号登录": "Phone Login",
|
||||||
"邮箱登录": "Email Login",
|
"邮箱登录": "Email Login",
|
||||||
"输入邮箱": "Enter Email"
|
"输入邮箱": "Enter Email",
|
||||||
|
"隐私协议加载失败": "Privacy Agreement Failed to Load",
|
||||||
|
"请检查网络连接后重试": "Please check the network connection and try again"
|
||||||
}
|
}
|
||||||
@@ -313,8 +313,8 @@
|
|||||||
"开始校准": "开始校准",
|
"开始校准": "开始校准",
|
||||||
"校准完成": "校准完成!",
|
"校准完成": "校准完成!",
|
||||||
"微信安装提示": "请先安装微信APP,再使用微信登录",
|
"微信安装提示": "请先安装微信APP,再使用微信登录",
|
||||||
"安卓启用网络提示": "",
|
"安卓启用网络提示": "网络未开启,请打开网络连接",
|
||||||
"ios启用网络提示": "",
|
"ios启用网络提示": "网络未开启,请打开网络连接",
|
||||||
"设备报修": "设备报修",
|
"设备报修": "设备报修",
|
||||||
"联系人": "联系人",
|
"联系人": "联系人",
|
||||||
"手机号": "手机号",
|
"手机号": "手机号",
|
||||||
@@ -624,7 +624,9 @@
|
|||||||
"注意!关闭后将无法接受任何消息":"注意!关闭后将无法接受任何消息",
|
"注意!关闭后将无法接受任何消息":"注意!关闭后将无法接受任何消息",
|
||||||
"手机号登录":"手机号登录",
|
"手机号登录":"手机号登录",
|
||||||
"邮箱登录":"邮箱登录",
|
"邮箱登录":"邮箱登录",
|
||||||
"输入邮箱":"输入邮箱"
|
"输入邮箱":"输入邮箱",
|
||||||
|
"隐私协议加载失败": "隐私协议加载失败",
|
||||||
|
"请检查网络连接后重试": "请检查网络连接后重试"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -314,8 +314,8 @@
|
|||||||
"开始校准": "開始校準",
|
"开始校准": "開始校準",
|
||||||
"校准完成": "校準完成!",
|
"校准完成": "校準完成!",
|
||||||
"微信安装提示": "請先安裝微信APP,再使用微信登錄",
|
"微信安装提示": "請先安裝微信APP,再使用微信登錄",
|
||||||
"安卓启用网络提示": "",
|
"安卓启用网络提示": "請開啟網絡,再使用APP",
|
||||||
"ios启用网络提示": "",
|
"ios启用网络提示": "請開啟網絡,再使用APP",
|
||||||
"设备报修": "設備報修",
|
"设备报修": "設備報修",
|
||||||
"联系人": "聯繫人",
|
"联系人": "聯繫人",
|
||||||
"手机号": "手機號",
|
"手机号": "手機號",
|
||||||
@@ -621,5 +621,7 @@
|
|||||||
"注意!关闭后将无法接受任何消息": "注意!關閉將無法接受任何消息",
|
"注意!关闭后将无法接受任何消息": "注意!關閉將無法接受任何消息",
|
||||||
"手机号登录": "手機登入",
|
"手机号登录": "手機登入",
|
||||||
"邮箱登录": "電子郵件登入",
|
"邮箱登录": "電子郵件登入",
|
||||||
"输入邮箱": "輸入電子郵件"
|
"输入邮箱": "輸入電子郵件",
|
||||||
|
"隐私协议加载失败": "隱私協議加載失敗",
|
||||||
|
"请检查网络连接后重试": "請檢查網絡連接後重試"
|
||||||
}
|
}
|
||||||
@@ -638,5 +638,9 @@
|
|||||||
"选择城市": "Select City",
|
"选择城市": "Select City",
|
||||||
"请选择城市": "city",
|
"请选择城市": "city",
|
||||||
"输入关键词": "Enter keywords",
|
"输入关键词": "Enter keywords",
|
||||||
"输入国家、省份或城市": "Enter country, province, or city"
|
"输入国家、省份或城市": "Enter country, province, or city",
|
||||||
|
"安卓启用网络提示": "The network is not enabled. Please enable the network connection",
|
||||||
|
"ios启用网络提示": "The network is not enabled. Please enable the network connection",
|
||||||
|
"隐私协议加载失败": "Privacy Agreement Failed to Load",
|
||||||
|
"请检查网络连接后重试": "Please check the network connection and try again"
|
||||||
}
|
}
|
||||||
@@ -645,5 +645,10 @@
|
|||||||
"选择城市": "选择城市",
|
"选择城市": "选择城市",
|
||||||
"请选择城市": "请选择城市",
|
"请选择城市": "请选择城市",
|
||||||
"输入关键词": "输入关键词",
|
"输入关键词": "输入关键词",
|
||||||
"输入国家、省份或城市": "输入国家、省份或城市"
|
"输入国家、省份或城市": "输入国家、省份或城市",
|
||||||
|
"安卓启用网络提示": "网络未开启,请打开网络连接",
|
||||||
|
"ios启用网络提示": "网络未开启,请打开网络连接",
|
||||||
|
"隐私协议加载失败": "隐私协议加载失败",
|
||||||
|
"请检查网络连接后重试": "请检查网络连接后重试"
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -638,5 +638,9 @@
|
|||||||
"选择城市": "選擇城市",
|
"选择城市": "選擇城市",
|
||||||
"请选择城市": "請選擇城市",
|
"请选择城市": "請選擇城市",
|
||||||
"输入关键词": "輸入關鍵詞",
|
"输入关键词": "輸入關鍵詞",
|
||||||
"输入国家、省份或城市": "輸入國家、省份或城市"
|
"输入国家、省份或城市": "輸入國家、省份或城市",
|
||||||
|
"安卓启用网络提示": "請開啟網絡,再使用APP",
|
||||||
|
"ios启用网络提示": "請開啟網絡,再使用APP",
|
||||||
|
"隐私协议加载失败": "隱私協議加載失敗",
|
||||||
|
"请检查网络连接后重试": "請檢查網絡連接後重試"
|
||||||
}
|
}
|
||||||
BIN
assets/miniapp/mhtControl_1.0.90.zip
Normal file
BIN
assets/miniapp/mhtControl_1.0.90.zip
Normal file
Binary file not shown.
@@ -5,8 +5,10 @@ import 'package:connectivity_plus/connectivity_plus.dart';
|
|||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
|
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||||
|
|
||||||
class Checknetwork {
|
class Checknetwork {
|
||||||
@@ -88,9 +90,32 @@ class Checknetwork {
|
|||||||
// showCustomConfirmDialog(context!, name).then((d) {
|
// showCustomConfirmDialog(context!, name).then((d) {
|
||||||
// isShowDialog = false;
|
// isShowDialog = false;
|
||||||
// });
|
// });
|
||||||
showTipDialog(context!,Text(name,style: TextStyle(
|
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||||
|
showTipDialog(
|
||||||
|
context!,
|
||||||
|
Text(
|
||||||
|
name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: stringToColor("333333"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: stringToColor("#FFFFFF"),
|
||||||
|
colors: [
|
||||||
|
stringToColor("1592AA"),
|
||||||
|
stringToColor("0C83A7"),
|
||||||
|
stringToColor("006FA3"),
|
||||||
|
]);
|
||||||
|
} else if (AppConstants().ent_type == APPPackageType.TH.code) {
|
||||||
|
showTipDialog(
|
||||||
|
context!,
|
||||||
|
Text(
|
||||||
|
name,
|
||||||
|
style: TextStyle(
|
||||||
color: themeController.currentColor.sc3,
|
color: themeController.currentColor.sc3,
|
||||||
),));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
37
lib/config/ConfigReader.dart
Normal file
37
lib/config/ConfigReader.dart
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// lib/utils/config_reader.dart
|
||||||
|
import 'dart:io';
|
||||||
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
|
class ConfigReader {
|
||||||
|
static int getAppType() {
|
||||||
|
try {
|
||||||
|
// 获取当前Dart文件所在目录
|
||||||
|
final scriptDir = File(Platform.script.toFilePath()).parent.path;
|
||||||
|
|
||||||
|
// 从lib目录向上回退到项目根目录,再进入android目录
|
||||||
|
final projectRoot = path.dirname(path.dirname(scriptDir));
|
||||||
|
final localPropertiesPath = path.join(projectRoot, 'android', 'local.properties');
|
||||||
|
|
||||||
|
final file = File(localPropertiesPath);
|
||||||
|
|
||||||
|
if (file.existsSync()) {
|
||||||
|
final content = file.readAsStringSync();
|
||||||
|
final lines = content.split('\n');
|
||||||
|
|
||||||
|
for (final line in lines) {
|
||||||
|
final trimmedLine = line.trim();
|
||||||
|
if (trimmedLine.startsWith('app.type=')) {
|
||||||
|
final value = trimmedLine.split('=')[1].trim();
|
||||||
|
return int.tryParse(value) ?? 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print('配置文件不存在: $localPropertiesPath');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('读取配置文件失败: $e');
|
||||||
|
}
|
||||||
|
|
||||||
|
return 3; // 默认值
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
|||||||
import 'package:vbvs_app/common/util/JPushUtil.dart';
|
import 'package:vbvs_app/common/util/JPushUtil.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||||
|
import 'package:vbvs_app/config/ConfigReader.dart';
|
||||||
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
||||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||||
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
||||||
@@ -982,6 +983,7 @@ class MyApp extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// final selectapp = ConfigReader.getAppType();
|
||||||
int selectapp = AppConstants().ent_type;
|
int selectapp = AppConstants().ent_type;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -1776,7 +1776,9 @@ Future showCustomConfirmOfWebViewDialog(
|
|||||||
{String btnName = "确定",
|
{String btnName = "确定",
|
||||||
bool showCancel = false,
|
bool showCancel = false,
|
||||||
String cancelName = "取消",
|
String cancelName = "取消",
|
||||||
ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async {
|
ConfirmDialogIcon icon = ConfirmDialogIcon.warn,
|
||||||
|
int type = 1
|
||||||
|
}) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
@@ -1863,7 +1865,7 @@ Future showCustomConfirmOfWebViewDialog(
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Get.back(result: "confirm");
|
Get.back(result: "confirm");
|
||||||
},
|
},
|
||||||
colors: AppConstants().mhtNormalButton, // 渐变背景
|
colors: type == 3?AppConstants().mhtNormalButton:AppConstants().thNormalButton, // 渐变背景
|
||||||
gradientDirection: GradientDirection.horizontal,
|
gradientDirection: GradientDirection.horizontal,
|
||||||
child: Container(
|
child: Container(
|
||||||
// width: MediaQuery.sizeOf(context).width * 0.5, // 宽度占屏幕一半
|
// width: MediaQuery.sizeOf(context).width * 0.5, // 宽度占屏幕一半
|
||||||
|
|||||||
@@ -137,7 +137,10 @@ class _HomePageState extends State<MainPageBBottomChange>
|
|||||||
cancelName = "退出".tr;
|
cancelName = "退出".tr;
|
||||||
}
|
}
|
||||||
showCustomConfirmOfWebViewDialog(context, "隐私协议".tr, getPrivacy(1),
|
showCustomConfirmOfWebViewDialog(context, "隐私协议".tr, getPrivacy(1),
|
||||||
btnName: btnName, showCancel: true, cancelName: cancelName)
|
btnName: btnName,
|
||||||
|
showCancel: true,
|
||||||
|
cancelName: cancelName,
|
||||||
|
type: 3)
|
||||||
.then((e) {
|
.then((e) {
|
||||||
if (e == "confirm") {
|
if (e == "confirm") {
|
||||||
getStorage.write("isShowYingShiDialog", "true");
|
getStorage.write("isShowYingShiDialog", "true");
|
||||||
|
|||||||
@@ -578,6 +578,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
|||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
String serviceApi = ServiceConstant.user_setting;
|
String serviceApi = ServiceConstant.user_setting;
|
||||||
String type = "control_${tmp['mac']}";
|
String type = "control_${tmp['mac']}";
|
||||||
|
if (tmp['type'] != null) {
|
||||||
|
type = "${type}_${tmp['type']}";
|
||||||
|
}
|
||||||
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
||||||
var data = {
|
var data = {
|
||||||
"type": type,
|
"type": type,
|
||||||
@@ -624,6 +627,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
|||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
String serviceApi = ServiceConstant.user_setting;
|
String serviceApi = ServiceConstant.user_setting;
|
||||||
String type = "control_${tmp}";
|
String type = "control_${tmp}";
|
||||||
|
if(tmp['type'] != null){
|
||||||
|
type = "control_${tmp['mac']}_${tmp['type']}";
|
||||||
|
}
|
||||||
String queryUrl =
|
String queryUrl =
|
||||||
"${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
"${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||||
await requestWithLog(
|
await requestWithLog(
|
||||||
|
|||||||
@@ -4,21 +4,17 @@ import 'package:ef/ef.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
|
||||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
|
||||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
|
||||||
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
||||||
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
|
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
|
||||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||||
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
|
|
||||||
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
||||||
import 'package:vbvs_app/pages/sleep_report/component/SleepScoreWidget.dart';
|
import 'package:vbvs_app/pages/sleep_report/component/SleepScoreWidget.dart';
|
||||||
import 'package:vbvs_app/pages/sleep_report/component/Vital_signs.dart';
|
import 'package:vbvs_app/pages/sleep_report/component/Vital_signs.dart';
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
),
|
),
|
||||||
].divide(SizedBox(width: 22.rpx)),
|
].divide(SizedBox(width: 22.rpx)),
|
||||||
),
|
),
|
||||||
Text('SWES2025.12.24',
|
Text('SWES2025.12.30',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 26.rpx,
|
fontSize: 26.rpx,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
|||||||
isheadless: false,
|
isheadless: false,
|
||||||
jsbridge: buildsdk(
|
jsbridge: buildsdk(
|
||||||
father: this,
|
father: this,
|
||||||
clientId: '494641114',
|
// clientId: '494641114',
|
||||||
// clientId: '123',
|
// clientId: '123',
|
||||||
// dbgserverUrl: 'ws://192.168.1.2:9001',
|
// dbgserverUrl: 'ws://192.168.1.2:9001',
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||||
@@ -8,6 +11,7 @@ import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
|||||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||||
|
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||||
|
|
||||||
class PrivacyPolicyNewPage extends StatefulWidget {
|
class PrivacyPolicyNewPage extends StatefulWidget {
|
||||||
var sleepUri;
|
var sleepUri;
|
||||||
@@ -27,16 +31,55 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
|||||||
DeviceTypeController deviceTypeController = Get.find();
|
DeviceTypeController deviceTypeController = Get.find();
|
||||||
|
|
||||||
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
|
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
|
||||||
|
ValueNotifier<bool> loadFailed = ValueNotifier<bool>(false);
|
||||||
|
Timer? _timeoutTimer;
|
||||||
|
InAppWebViewController? _webViewController;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
// 启动5秒超时计时器
|
||||||
|
_startTimeoutTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _startTimeoutTimer() {
|
||||||
|
// 先清除之前的计时器
|
||||||
|
_timeoutTimer?.cancel();
|
||||||
|
|
||||||
|
// 设置5秒超时
|
||||||
|
_timeoutTimer = Timer(Duration(seconds: 5), () {
|
||||||
|
if (isPageLoading.value) {
|
||||||
|
// 5秒后仍在加载,显示加载失败
|
||||||
|
isPageLoading.value = false;
|
||||||
|
loadFailed.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _retryLoad() {
|
||||||
|
// 重置状态
|
||||||
|
loadFailed.value = false;
|
||||||
|
isPageLoading.value = true;
|
||||||
|
|
||||||
|
// 重新启动超时计时器
|
||||||
|
_startTimeoutTimer();
|
||||||
|
|
||||||
|
// 重新加载页面
|
||||||
|
if (_webViewController != null) {
|
||||||
|
_webViewController!.reload();
|
||||||
|
} else {
|
||||||
|
// 如果控制器还未初始化,需要重新构建webview
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// 清理 ValueNotifier
|
// 清理所有资源
|
||||||
|
_timeoutTimer?.cancel();
|
||||||
isPageLoading.dispose();
|
isPageLoading.dispose();
|
||||||
|
loadFailed.dispose();
|
||||||
|
_webViewController = null;
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,17 +87,10 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, bodySize) => GestureDetector(
|
builder: (context, bodySize) => GestureDetector(
|
||||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
|
||||||
child: Container(
|
child: Container(
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// image: DecorationImage(
|
|
||||||
// image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
|
||||||
// fit: BoxFit.fill, // 填满整个 Container
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Colors.transparent, // 背景透明
|
backgroundColor: Colors.transparent,
|
||||||
appBar: (widget.showAppbar != null && widget.showAppbar == false)
|
appBar: (widget.showAppbar != null && widget.showAppbar == false)
|
||||||
? null
|
? null
|
||||||
: AppBar(
|
: AppBar(
|
||||||
@@ -91,21 +127,55 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
|||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
top: true,
|
top: true,
|
||||||
child: Stack(
|
child: ValueListenableBuilder<bool>(
|
||||||
|
valueListenable: loadFailed,
|
||||||
|
builder: (context, failed, child) {
|
||||||
|
if (failed) {
|
||||||
|
// 显示加载失败页面
|
||||||
|
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||||
|
return _buildErrorView();
|
||||||
|
}
|
||||||
|
return _buildTHErrorView();
|
||||||
|
} else {
|
||||||
|
// 显示WebView或加载指示器
|
||||||
|
return _buildWebView();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildWebView() {
|
||||||
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.fromLTRB(0, 0, 30.rpx, 0),
|
padding: EdgeInsets.fromLTRB(0, 0, 30.rpx, 0),
|
||||||
child: InAppWebView(
|
child: InAppWebView(
|
||||||
key: UniqueKey(),
|
key: UniqueKey(),
|
||||||
initialUrlRequest:
|
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
|
||||||
URLRequest(url: WebUri(widget.sleepUri)),
|
onWebViewCreated: (controller) {
|
||||||
|
_webViewController = controller;
|
||||||
|
},
|
||||||
onLoadStart: (controller, url) {
|
onLoadStart: (controller, url) {
|
||||||
// 页面开始加载时显示加载指示器
|
// 页面开始加载时显示加载指示器
|
||||||
isPageLoading.value = true;
|
isPageLoading.value = true;
|
||||||
|
loadFailed.value = false;
|
||||||
},
|
},
|
||||||
onLoadStop: (controller, url) {
|
onLoadStop: (controller, url) {
|
||||||
// 页面加载完成后隐藏加载指示器
|
// 页面加载完成后隐藏加载指示器
|
||||||
isPageLoading.value = false;
|
isPageLoading.value = false;
|
||||||
|
loadFailed.value = false;
|
||||||
|
_timeoutTimer?.cancel(); // 加载成功时取消计时器
|
||||||
|
},
|
||||||
|
onLoadError: (controller, url, code, message) {
|
||||||
|
// 加载出错时显示失败页面
|
||||||
|
isPageLoading.value = false;
|
||||||
|
loadFailed.value = true;
|
||||||
|
_timeoutTimer?.cancel(); // 出错时取消计时器
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -114,21 +184,148 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
|||||||
builder: (context, isLoading, child) {
|
builder: (context, isLoading, child) {
|
||||||
return isLoading
|
return isLoading
|
||||||
? Center(
|
? Center(
|
||||||
child:CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
themeController.currentColor.sc1,
|
themeController.currentColor.sc1,
|
||||||
),
|
),
|
||||||
), // 加载指示器
|
),
|
||||||
)
|
)
|
||||||
: SizedBox.shrink();
|
: SizedBox.shrink();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//眠花糖
|
||||||
|
Widget _buildErrorView() {
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.wifi_off,
|
||||||
|
size: 60.rpx,
|
||||||
|
color: stringToColor("84F5FF"),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20.rpx),
|
||||||
|
Text(
|
||||||
|
'隐私协议加载失败'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.rpx,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'请检查网络连接后重试'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.rpx,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 30.rpx),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: _retryLoad,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: stringToColor("84F5FF"),
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 40.rpx,
|
||||||
|
vertical: 15.rpx,
|
||||||
|
),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(25.rpx),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'重试'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.rpx,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//太和
|
||||||
|
Widget _buildTHErrorView() {
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.wifi_off,
|
||||||
|
size: 60.rpx,
|
||||||
|
// color: stringToColor("84F5FF"),
|
||||||
|
color: themeController.currentColor.sc2,
|
||||||
|
),
|
||||||
|
SizedBox(height: 20.rpx),
|
||||||
|
Text(
|
||||||
|
'隐私协议加载失败'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: AppConstants().title_text_fontSize,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'请检查网络连接后重试'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24.rpx,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 30.rpx),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: _retryLoad,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateProperty.all(Colors.transparent),
|
||||||
|
foregroundColor: MaterialStateProperty.all(Colors.white),
|
||||||
|
padding: MaterialStateProperty.all(
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
horizontal: 40.rpx,
|
||||||
|
vertical: 15.rpx,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
shape: MaterialStateProperty.all(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(25.rpx),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
overlayColor:
|
||||||
|
MaterialStateProperty.all(Colors.white.withOpacity(0.2)),
|
||||||
|
elevation: MaterialStateProperty.all(0),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
// 这里设置您的渐变色
|
||||||
|
themeController.currentColor.sc2,
|
||||||
|
themeController.currentColor.sc1, // 假设这是另一种颜色
|
||||||
|
],
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(25.rpx),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 40.rpx,
|
||||||
|
vertical: 15.rpx,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'重试'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.rpx,
|
||||||
|
color: Colors.white, // 建议白色文字,渐变背景下更清晰
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
|||||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||||
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
||||||
|
|
||||||
//睡眠规律性
|
//生命体征
|
||||||
class VitalSignsWidget extends StatefulWidget {
|
class VitalSignsWidget extends StatefulWidget {
|
||||||
var sleepReport;
|
var sleepReport;
|
||||||
final VoidCallback? onRefresh; // 添加回调函数
|
final VoidCallback? onRefresh; // 添加回调函数
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
|||||||
if (Get.isRegistered<SleepReportController>()) {
|
if (Get.isRegistered<SleepReportController>()) {
|
||||||
sleepReportController.isLoading.value = false;
|
sleepReportController.isLoading.value = false;
|
||||||
sleepReportController.model.type = 1;
|
sleepReportController.model.type = 1;
|
||||||
sleepReportController.sleepReport.value = {};
|
// sleepReportController.sleepReport.value = {};
|
||||||
|
//返回详情无数据ios
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user