更新新版控制
This commit is contained in:
@@ -1776,7 +1776,9 @@ Future showCustomConfirmOfWebViewDialog(
|
||||
{String btnName = "确定",
|
||||
bool showCancel = false,
|
||||
String cancelName = "取消",
|
||||
ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async {
|
||||
ConfirmDialogIcon icon = ConfirmDialogIcon.warn,
|
||||
int type = 1
|
||||
}) async {
|
||||
return showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
@@ -1863,7 +1865,7 @@ Future showCustomConfirmOfWebViewDialog(
|
||||
onTap: () {
|
||||
Get.back(result: "confirm");
|
||||
},
|
||||
colors: AppConstants().mhtNormalButton, // 渐变背景
|
||||
colors: type == 3?AppConstants().mhtNormalButton:AppConstants().thNormalButton, // 渐变背景
|
||||
gradientDirection: GradientDirection.horizontal,
|
||||
child: Container(
|
||||
// width: MediaQuery.sizeOf(context).width * 0.5, // 宽度占屏幕一半
|
||||
|
||||
@@ -137,7 +137,10 @@ class _HomePageState extends State<MainPageBBottomChange>
|
||||
cancelName = "退出".tr;
|
||||
}
|
||||
showCustomConfirmOfWebViewDialog(context, "隐私协议".tr, getPrivacy(1),
|
||||
btnName: btnName, showCancel: true, cancelName: cancelName)
|
||||
btnName: btnName,
|
||||
showCancel: true,
|
||||
cancelName: cancelName,
|
||||
type: 3)
|
||||
.then((e) {
|
||||
if (e == "confirm") {
|
||||
getStorage.write("isShowYingShiDialog", "true");
|
||||
|
||||
@@ -578,6 +578,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "control_${tmp['mac']}";
|
||||
if (tmp['type'] != null) {
|
||||
type = "${type}_${tmp['type']}";
|
||||
}
|
||||
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
||||
var data = {
|
||||
"type": type,
|
||||
@@ -624,6 +627,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "control_${tmp}";
|
||||
if(tmp['type'] != null){
|
||||
type = "control_${tmp['mac']}_${tmp['type']}";
|
||||
}
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||
await requestWithLog(
|
||||
|
||||
@@ -4,21 +4,17 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.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/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.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/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
||||
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.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/sleep_report/component/SleepScoreWidget.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)),
|
||||
),
|
||||
Text('SWES2025.12.24',
|
||||
Text('SWES2025.12.30',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
|
||||
@@ -45,7 +45,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
isheadless: false,
|
||||
jsbridge: buildsdk(
|
||||
father: this,
|
||||
clientId: '494641114',
|
||||
// clientId: '494641114',
|
||||
// clientId: '123',
|
||||
// dbgserverUrl: 'ws://192.168.1.2:9001',
|
||||
),
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.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/MyUtils.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/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
|
||||
class PrivacyPolicyNewPage extends StatefulWidget {
|
||||
var sleepUri;
|
||||
@@ -27,16 +31,55 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
||||
DeviceTypeController deviceTypeController = Get.find();
|
||||
|
||||
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
|
||||
ValueNotifier<bool> loadFailed = ValueNotifier<bool>(false);
|
||||
Timer? _timeoutTimer;
|
||||
InAppWebViewController? _webViewController;
|
||||
|
||||
@override
|
||||
void 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
|
||||
void dispose() {
|
||||
// 清理 ValueNotifier
|
||||
// 清理所有资源
|
||||
_timeoutTimer?.cancel();
|
||||
isPageLoading.dispose();
|
||||
loadFailed.dispose();
|
||||
_webViewController = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -44,17 +87,10 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
// fit: BoxFit.fill, // 填满整个 Container
|
||||
// ),
|
||||
// ),
|
||||
color: Colors.white,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 背景透明
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: (widget.showAppbar != null && widget.showAppbar == false)
|
||||
? null
|
||||
: AppBar(
|
||||
@@ -91,40 +127,20 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 0, 30.rpx, 0),
|
||||
child: InAppWebView(
|
||||
key: UniqueKey(),
|
||||
initialUrlRequest:
|
||||
URLRequest(url: WebUri(widget.sleepUri)),
|
||||
onLoadStart: (controller, url) {
|
||||
// 页面开始加载时显示加载指示器
|
||||
isPageLoading.value = true;
|
||||
},
|
||||
onLoadStop: (controller, url) {
|
||||
// 页面加载完成后隐藏加载指示器
|
||||
isPageLoading.value = false;
|
||||
},
|
||||
),
|
||||
),
|
||||
ValueListenableBuilder<bool>(
|
||||
valueListenable: isPageLoading,
|
||||
builder: (context, isLoading, child) {
|
||||
return isLoading
|
||||
? Center(
|
||||
child:CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
), // 加载指示器
|
||||
)
|
||||
: SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
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();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -132,4 +148,185 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWebView() {
|
||||
return Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 0, 30.rpx, 0),
|
||||
child: InAppWebView(
|
||||
key: UniqueKey(),
|
||||
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
|
||||
onWebViewCreated: (controller) {
|
||||
_webViewController = controller;
|
||||
},
|
||||
onLoadStart: (controller, url) {
|
||||
// 页面开始加载时显示加载指示器
|
||||
isPageLoading.value = true;
|
||||
loadFailed.value = false;
|
||||
},
|
||||
onLoadStop: (controller, url) {
|
||||
// 页面加载完成后隐藏加载指示器
|
||||
isPageLoading.value = false;
|
||||
loadFailed.value = false;
|
||||
_timeoutTimer?.cancel(); // 加载成功时取消计时器
|
||||
},
|
||||
onLoadError: (controller, url, code, message) {
|
||||
// 加载出错时显示失败页面
|
||||
isPageLoading.value = false;
|
||||
loadFailed.value = true;
|
||||
_timeoutTimer?.cancel(); // 出错时取消计时器
|
||||
},
|
||||
),
|
||||
),
|
||||
ValueListenableBuilder<bool>(
|
||||
valueListenable: isPageLoading,
|
||||
builder: (context, isLoading, child) {
|
||||
return isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
),
|
||||
)
|
||||
: 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/mh_page/homepage/controller/mht_home_controller.dart';
|
||||
|
||||
//睡眠规律性
|
||||
//生命体征
|
||||
class VitalSignsWidget extends StatefulWidget {
|
||||
var sleepReport;
|
||||
final VoidCallback? onRefresh; // 添加回调函数
|
||||
|
||||
@@ -59,7 +59,8 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
if (Get.isRegistered<SleepReportController>()) {
|
||||
sleepReportController.isLoading.value = false;
|
||||
sleepReportController.model.type = 1;
|
||||
sleepReportController.sleepReport.value = {};
|
||||
// sleepReportController.sleepReport.value = {};
|
||||
//返回详情无数据ios
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user