多语言后端数据

This commit is contained in:
czz
2025-08-01 22:25:47 +08:00
parent 12a53ac36c
commit a199606f80
52 changed files with 1736 additions and 1142 deletions

View File

@@ -270,8 +270,8 @@
"无效的手机号码": "Invalid Phone", "无效的手机号码": "Invalid Phone",
"保存": "Save", "保存": "Save",
"智能设备名称": "Smart Device Name", "智能设备名称": "Smart Device Name",
"智能电动床": "Smart Electric Bed", "智能电动床": "Bed",
"律动智能床垫": "Massage Smart Mattress", "律动智能床垫": "Mattress",
"更新设备信息": "Update Device Info", "更新设备信息": "Update Device Info",
"修改名称成功": "Name Updated", "修改名称成功": "Name Updated",
"请输入设备的名称": "Enter Device Name", "请输入设备的名称": "Enter Device Name",
@@ -546,7 +546,7 @@
"正在打开微信客服...": "Opening WeChat Support...", "正在打开微信客服...": "Opening WeChat Support...",
"起床时间:": "Wake Up:", "起床时间:": "Wake Up:",
"入睡时间:": "Sleep Time", "入睡时间:": "Sleep Time",
"入睡时间": "Sleep Time", "入睡时间": "Sleep Onset Time",
"起床时间": "起床时间", "起床时间": "起床时间",
"次": "Times", "次": "Times",
"次/分": "times/min", "次/分": "times/min",
@@ -554,15 +554,15 @@
"sleep_duration": "Sleep Duration", "sleep_duration": "Sleep Duration",
"deep_sleep": "Deep Sleep", "deep_sleep": "Deep Sleep",
"light_sleep": "Light Sleep", "light_sleep": "Light Sleep",
"小时": "hour", "小时": "h",
"今日": "Today", "今日": "Today",
"30天平均分": "30-Day Average Score", "30天平均分": "30-Day Average Score",
"睡眠评分": "Sleep Score", "睡眠评分": "Sleep Score",
"睡眠等级": "Sleep Level", "睡眠等级": "Sleep Level",
"睡眠规律性": "Sleep Regularity", "睡眠规律性": "Sleep Regularity",
"睡眠规律性是指个体睡眠模式在时间、时长、环境等方面呈现出的稳定性和一致性,是衡量睡眠质量的重要指标之一。": "Sleep regularity reflects how consistent your sleep time, duration, and habits are — a key factor in overall sleep quality.", "睡眠规律性是指个体睡眠模式在时间、时长、环境等方面呈现出的稳定性和一致性,是衡量睡眠质量的重要指标之一。": "Sleep regularity reflects how consistent your sleep time, duration, and habits are — a key factor in overall sleep quality.",
"分钟": "min", "分钟": "m",
"睡眠时长": "Sleep Time", "睡眠时长": "Sleep Duration",
"当前属于": " Current:", "当前属于": " Current:",
"与昨日对比分析": "Comparison with Yesterday", "与昨日对比分析": "Comparison with Yesterday",
"基于时间维度的横向比较分析方法,通过将当前(今日)的数据、状态、行为等与前一日(昨日)的同类信息进行对照,识别差异、趋势或变化规律,查看用户短期时间序列的动态变化。": "A time-based horizontal comparison method that contrasts current (today's) data, status, and behaviors with those of the previous day (yesterday) to identify differences, trends, or patterns, enabling observation of short-term dynamic changes in the user's time series.", "基于时间维度的横向比较分析方法,通过将当前(今日)的数据、状态、行为等与前一日(昨日)的同类信息进行对照,识别差异、趋势或变化规律,查看用户短期时间序列的动态变化。": "A time-based horizontal comparison method that contrasts current (today's) data, status, and behaviors with those of the previous day (yesterday) to identify differences, trends, or patterns, enabling observation of short-term dynamic changes in the user's time series.",
@@ -590,5 +590,9 @@
"自主神经平衡指数": "Autonomic Balance Index", "自主神经平衡指数": "Autonomic Balance Index",
"自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。": "The Autonomic Nervous System Balance Index is an important metric for assessing ANS function, reflecting the balance between sympathetic and parasympathetic nervous activity.", "自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。": "The Autonomic Nervous System Balance Index is an important metric for assessing ANS function, reflecting the balance between sympathetic and parasympathetic nervous activity.",
"皮肤指数": "Skin Index", "皮肤指数": "Skin Index",
"皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。": "The Skin Index is a composite metric derived from physiological data during sleep by measuring skin conductance. It evaluates physiological stress and autonomic nervous activity during sleep." "皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。": "The Skin Index is a composite metric derived from physiological data during sleep by measuring skin conductance. It evaluates physiological stress and autonomic nervous activity during sleep.",
"删除后": "After deletion",
"该设备的历史数据将被清除": "The device's historical data will be deleted",
"有一条新的设备分享消息": "You have a new device sharing message",
"去查看": "View now"
} }

View File

@@ -585,8 +585,10 @@
"心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息来判断其心理健康水平、疲劳程度。": "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息来判断其心理健康水平、疲劳程度。", "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息来判断其心理健康水平、疲劳程度。": "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息来判断其心理健康水平、疲劳程度。",
"慢性病风险指数": "慢性病风险指数", "慢性病风险指数": "慢性病风险指数",
"慢性病风险指数是通过整合个体的生理指标、生活方式等多维度数据,构建的量化评估模型,用于预测用户未来患慢性非传染性疾病(如高血压、糖尿病、冠心病、癌症等)的风险概率。": "慢性病风险指数是通过整合个体的生理指标、生活方式等多维度数据,构建的量化评估模型,用于预测用户未来患慢性非传染性疾病(如高血压、糖尿病、冠心病、癌症等)的风险概率。", "慢性病风险指数是通过整合个体的生理指标、生活方式等多维度数据,构建的量化评估模型,用于预测用户未来患慢性非传染性疾病(如高血压、糖尿病、冠心病、癌症等)的风险概率。": "慢性病风险指数是通过整合个体的生理指标、生活方式等多维度数据,构建的量化评估模型,用于预测用户未来患慢性非传染性疾病(如高血压、糖尿病、冠心病、癌症等)的风险概率。",
"自主神经平衡指数":"自主神经平衡指数", "自主神经平衡指数": "自主神经平衡指数",
"自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。": "自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。", "自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。": "自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。",
"皮肤指数": "皮肤指数", "皮肤指数": "皮肤指数",
"皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。": "皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。" "皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。": "皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。",
"删除后": "删除后",
"该设备的历史数据将被清除": "该设备的历史数据将被清除","有一条新的设备分享消息":"有一条新的设备分享消息","去查看":"去查看"
} }

View File

@@ -588,5 +588,7 @@
"自主神经平衡指数": "自主神經平衡指數", "自主神经平衡指数": "自主神經平衡指數",
"自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。": "自主神經平衡指數 是評估人體自主神經系統ANS功能狀態的重要指標主要反映交感神經和副交感神經的活性平衡關係。", "自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。": "自主神經平衡指數 是評估人體自主神經系統ANS功能狀態的重要指標主要反映交感神經和副交感神經的活性平衡關係。",
"皮肤指数": "皮膚指數", "皮肤指数": "皮膚指數",
"皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。": "皮膚指數透過用戶睡眠過程中的體徵資料,計算皮膚電反應,生成綜合評估指標,用於睡眠中的生理應激狀態或自主神經活動。" "皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。": "皮膚指數透過用戶睡眠過程中的體徵資料,計算皮膚電反應,生成綜合評估指標,用於睡眠中的生理應激狀態或自主神經活動。",
"删除后": "刪除後",
"该设备的历史数据将被清除": "該設備的歷史數據將被清除","有一条新的设备分享消息": "有一條新的設備分享消息","去查看": "去查看"
} }

View File

@@ -2,9 +2,11 @@ import 'dart:convert';
import 'package:EasyDartModule/EasyDartModule.dart'; import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:ef/ef.dart'; import 'package:ef/ef.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/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.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/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
Future<ApiResponse> requestWithLog({ Future<ApiResponse> requestWithLog({
@@ -23,9 +25,16 @@ Future<ApiResponse> requestWithLog({
ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr); ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
try { try {
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (AppConstants().ent_type == APPPackageType.MHT.code) {
language = languageController.selectLanguage.value!.language_code; if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
queryUrl += "&lang=$language"; queryUrl += "&lang=$language";

View File

@@ -32,7 +32,7 @@ class SleepCalendarWidget extends StatefulWidget {
class _SleepCalendarWidgetState extends State<SleepCalendarWidget> { class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
CalendarController calendarController = Get.find(); CalendarController calendarController = Get.find();
RxMap sleepDate = <String, dynamic>{}.obs; RxMap sleepDate = <dynamic, dynamic>{}.obs;
RxList showLabel = <dynamic>[ RxList showLabel = <dynamic>[
{"level": 5, "name": "无报告", "color": "#9E9E9E"} {"level": 5, "name": "无报告", "color": "#9E9E9E"}
].obs; ].obs;
@@ -206,7 +206,8 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
return Container( return Container(
constraints: BoxConstraints(minHeight: 90.rpx), constraints: BoxConstraints(minHeight: 90.rpx),
child: Row( child: Row(
children: ["".tr, "".tr, "".tr, "".tr, "".tr, "".tr, "".tr].map((day) { children:
["".tr, "".tr, "".tr, "".tr, "".tr, "".tr, "".tr].map((day) {
return Expanded( return Expanded(
child: Center( child: Center(
child: Text( child: Text(
@@ -223,6 +224,96 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
); );
} }
// Widget _buildCalendarGrid(List<List<DateTime>> calendarRows,
// DateTime? selectedDate, Map sleepDate) {
// final isMonthSelected = widget.type == 3;
// Widget content = Column(
// children: calendarRows.map((week) {
// final isWeekSelected = widget.type == 2 &&
// selectedDate != null &&
// week.any((d) =>
// d.year == selectedDate.year &&
// d.month == selectedDate.month &&
// d.day == selectedDate.day);
// final row = Row(
// children: week.map((date) {
// if (date.year == 0) {
// return const Expanded(child: SizedBox.shrink());
// }
// final isSelected = widget.type == 1 &&
// selectedDate != null &&
// date.year == selectedDate.year &&
// date.month == selectedDate.month &&
// date.day == selectedDate.day;
// return Expanded(
// child: SleepdateWidget(
// highlightColor: widget.highlightColor, // ✅ 传入高亮颜色
// sleepDate: sleepDate,
// date: date,
// isSelected: isSelected,
// onTap: () {
// calendarController.selectDate(date);
// widget.onDateSelected?.call(date);
// Get.back();
// },
// ),
// );
// }).toList(),
// );
// if (isWeekSelected) {
// return Container(
// decoration: BoxDecoration(
// color: widget.highlightColor,
// borderRadius:
// BorderRadius.circular(AppConstants().button_container_radius),
// ),
// padding: EdgeInsets.symmetric(
// vertical: 6.rpx, horizontal: 12.rpx), // 增加左右padding
// margin: EdgeInsets.symmetric(vertical: 6.rpx),
// child: row,
// );
// } else {
// return row;
// }
// }).toList(),
// );
// // 如果是月份模式,包一层黑色背景容器
// if (isMonthSelected && selectedDate != null) {
// final displayedMonth = calendarController.displayedMonth.value;
// final isSameMonth = displayedMonth.year == selectedDate.year &&
// displayedMonth.month == selectedDate.month;
// if (isSameMonth) {
// // ✅ 当前显示的月 == 当前选中的月 → 加高亮外框
// return Container(
// decoration: BoxDecoration(
// color: widget.highlightColor, // 背景淡色
// borderRadius:
// BorderRadius.circular(AppConstants().normal_container_radius),
// // border: Border.all(
// // color: widget.highlightColor,
// // width: 2.rpx,
// // ),
// ),
// // padding: EdgeInsets.symmetric(vertical: 0.rpx, horizontal: 0.rpx),
// // margin: EdgeInsets.symmetric(vertical: 0.rpx),
// child: content,
// );
// } else {
// return content;
// }
// } else {
// return content;
// }
// }
Widget _buildCalendarGrid(List<List<DateTime>> calendarRows, Widget _buildCalendarGrid(List<List<DateTime>> calendarRows,
DateTime? selectedDate, Map sleepDate) { DateTime? selectedDate, Map sleepDate) {
final isMonthSelected = widget.type == 3; final isMonthSelected = widget.type == 3;
@@ -250,7 +341,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
return Expanded( return Expanded(
child: SleepdateWidget( child: SleepdateWidget(
highlightColor: widget.highlightColor, // ✅ 传入高亮颜色 highlightColor: widget.highlightColor,
sleepDate: sleepDate, sleepDate: sleepDate,
date: date, date: date,
isSelected: isSelected, isSelected: isSelected,
@@ -271,8 +362,8 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
borderRadius: borderRadius:
BorderRadius.circular(AppConstants().button_container_radius), BorderRadius.circular(AppConstants().button_container_radius),
), ),
padding: EdgeInsets.symmetric(vertical: 6.rpx), // 把padding改成margin避免Row宽度变化导致跳动
margin: EdgeInsets.symmetric(vertical: 6.rpx), margin: EdgeInsets.symmetric(vertical: 6.rpx, horizontal: 12.rpx),
child: row, child: row,
); );
} else { } else {
@@ -281,7 +372,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
}).toList(), }).toList(),
); );
// 如果是月份模式,包一层黑色背景容器 // 月视图高亮逻辑不变
if (isMonthSelected && selectedDate != null) { if (isMonthSelected && selectedDate != null) {
final displayedMonth = calendarController.displayedMonth.value; final displayedMonth = calendarController.displayedMonth.value;
@@ -289,19 +380,12 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
displayedMonth.month == selectedDate.month; displayedMonth.month == selectedDate.month;
if (isSameMonth) { if (isSameMonth) {
// ✅ 当前显示的月 == 当前选中的月 → 加高亮外框
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.highlightColor, // 背景淡色 color: widget.highlightColor,
borderRadius: borderRadius:
BorderRadius.circular(AppConstants().normal_container_radius), BorderRadius.circular(AppConstants().normal_container_radius),
// border: Border.all(
// color: widget.highlightColor,
// width: 2.rpx,
// ),
), ),
// padding: EdgeInsets.symmetric(vertical: 0.rpx, horizontal: 0.rpx),
// margin: EdgeInsets.symmetric(vertical: 0.rpx),
child: content, child: content,
); );
} else { } else {

View File

@@ -1,5 +1,6 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import '../../common/color/appFontsize.dart'; import '../../common/color/appFontsize.dart';
import '../../controller/mh_controller/apply_repair_controller.dart'; import '../../controller/mh_controller/apply_repair_controller.dart';
@@ -21,31 +22,20 @@ class ImgPreviewWidget extends GetView {
width: MediaQuery.sizeOf(context).width * 0.25, width: MediaQuery.sizeOf(context).width * 0.25,
height: MediaQuery.sizeOf(context).height * 0.15, height: MediaQuery.sizeOf(context).height * 0.15,
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: 140, // minHeight: 140,
), ),
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Expanded( ClipRRect(
child: Container( borderRadius: BorderRadius.circular(8),
width: MediaQuery.sizeOf(context).width, child: AspectRatio(
height: MediaQuery.sizeOf(context).height * 0.116, aspectRatio: 1, // 保证宽高比1:1
decoration: BoxDecoration( child: Image.network(
color: Colors.transparent, imgUrl,
borderRadius: BorderRadius.circular(8), fit: BoxFit.cover,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.network(
imgUrl,
// applyRepairController.getPublicUrl(imgUrl),
width: 300,
height: 200,
fit: BoxFit.cover,
),
), ),
), ),
), ),
@@ -76,3 +66,55 @@ class ImgPreviewWidget extends GetView {
); );
} }
} }
// class ImgPreviewWidget extends GetView {
// final String imgUrl;
// final int index;
// final ApplyRepairController applyRepairController;
// final bool isDel;
// ImgPreviewWidget({
// required this.imgUrl,
// required this.index,
// required this.applyRepairController,
// required this.isDel,
// });
// @override
// Widget build(BuildContext context) {
// return Column(
// mainAxisSize: MainAxisSize.min, // 不撑满 ListView 高度
// children: [
// // 正方形图片容器
// AspectRatio(
// aspectRatio: 1,
// child: ClipRRect(
// borderRadius: BorderRadius.circular(8),
// child: Image.network(
// imgUrl,
// fit: BoxFit.cover,
// ),
// ),
// ),
// // 删除按钮
// if (isDel)
// Padding(
// padding: const EdgeInsets.only(top: 6),
// child: InkWell(
// onTap: () {
// applyRepairController.model.issue_img!.removeAt(index);
// applyRepairController.updateAll();
// },
// child: Text(
// '删除',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFF9EA4B7),
// fontSize: AppFontsize.small_text_size,
// ),
// ),
// ),
// ),
// ],
// );
// }
// }

View File

@@ -7,6 +7,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
class TopSlideNotification extends StatefulWidget { class TopSlideNotification extends StatefulWidget {
BuildContext?context;
final String text; final String text;
double? fontSize = 26.rpx; double? fontSize = 26.rpx;
Color? textColor; Color? textColor;

View File

@@ -1,6 +1,9 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
class CalendarController extends GetControllerEx { class CalendarController extends GetControllerEx {
CalendarController() {
attr = GetModel({}).obs; // 传入一个空Map作为模型
}
Rx<DateTime> displayedMonth = DateTime.now().obs; Rx<DateTime> displayedMonth = DateTime.now().obs;
Rx<DateTime?> selectedDate = Rx<DateTime?>(null); Rx<DateTime?> selectedDate = Rx<DateTime?>(null);

View File

@@ -15,7 +15,7 @@ part 'device_share_list_controller.g.dart'; // 由json_serializable自动生成
class DeviceShareListModel { class DeviceShareListModel {
String? key; //关键字搜索 String? key; //关键字搜索
int? all = 0; //是否全选 0不全选 1全选 int? all = 0; //是否全选 0不全选 1全选
String? accountKey = 'uid';//账户key String? accountKey = 'uid'; //账户key
DeviceShareListModel(); DeviceShareListModel();

View File

@@ -80,9 +80,9 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
String serviceApi = ServiceConstant.upload_file; String serviceApi = ServiceConstant.upload_file;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
queryUrl += "&lang=$language"; queryUrl += "&lang=$language";

View File

@@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:ui'; import 'dart:ui';
import 'package:EasyDartModule/EasyDartModule.dart'; import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:ef/base/http/dio.dart';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
@@ -49,7 +50,8 @@ class DeviceListController extends GetControllerEx<DeviceListModel> {
String serviceName = ServiceConstant.server_service; String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list; String serviceApi = ServiceConstant.device_list;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}$search"; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}$search";
var response = await EasyDartModule.dio.get(queryUrl); var response = await EasyDartModule.dio
.get(queryUrl);
if (response != null) { if (response != null) {
var responseData = var responseData =
response.data is String ? jsonDecode(response.data) : response.data; response.data is String ? jsonDecode(response.data) : response.data;

View File

@@ -27,10 +27,10 @@ class IssueListController extends GetControllerEx<IssueListModel> {
IssueListController() { IssueListController() {
attr = GetModel(IssueListModel()).obs; attr = GetModel(IssueListModel()).obs;
} }
void onInit() async { // void onInit() async {
super.onInit(); // super.onInit();
await getIssueList(); // await getIssueList();
} // }
getIssueList() async { getIssueList() async {
model.isLoading = true; model.isLoading = true;

View File

@@ -61,8 +61,8 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
String queryUrl = String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${messageType}"; "${serviceAddress}${serviceName}${serviceApi}?type=${messageType}";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
@@ -114,8 +114,8 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
@@ -180,8 +180,8 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
} }
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {

View File

@@ -11,6 +11,7 @@ import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.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/enum/APPPackageType.dart';
import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
part 'mhdevice_share_controller.g.dart'; part 'mhdevice_share_controller.g.dart';
@@ -74,8 +75,14 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
String serviceApi = ServiceConstant.device_share; String serviceApi = ServiceConstant.device_share;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (AppConstants().ent_type == APPPackageType.MHT.code) {
language = languageController.selectLanguage.value!.language_code; if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
@@ -152,8 +159,14 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
String serviceApi = ServiceConstant.device_share; String serviceApi = ServiceConstant.device_share;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (AppConstants().ent_type == APPPackageType.MHT.code) {
language = languageController.selectLanguage.value!.language_code; if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {

View File

@@ -104,7 +104,7 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
: response.data; : response.data;
ApiResponse res = ApiResponse res =
ApiResponse.fromJson(responseData, (object) => object); ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(apiResponse, "上传成功".tr, "头像上传失败".tr); MyUtils.formatResponse(res, "上传成功".tr, "头像上传失败".tr);
model.user!.tmpHead = res.data['path']; model.user!.tmpHead = res.data['path'];
updateAll(); updateAll();
return res; return res;

View File

@@ -3,6 +3,7 @@ import 'dart:ui';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
class AppLanguage extends Translations { class AppLanguage extends Translations {
// 私有构造函数 // 私有构造函数
@@ -49,14 +50,14 @@ class AppLanguage extends Translations {
// } // }
Future<void> loadLanguage(String languageCode, Future<void> loadLanguage(String languageCode,
{String project = 'th'}) async { {int project = 1}) async {
try { try {
final jsonString; final jsonString;
// 加载 JSON 文件 // 加载 JSON 文件
if (project == 'th') { if (project ==APPPackageType.TH.code ) {
jsonString = jsonString =
await rootBundle.loadString('assets/langs/$languageCode.json'); await rootBundle.loadString('assets/langs/$languageCode.json');
} else if (project == 'mht') { } else if (project == APPPackageType.MHT.code) {
jsonString = jsonString =
await rootBundle.loadString('assets/mhlangs/$languageCode.json'); await rootBundle.loadString('assets/mhlangs/$languageCode.json');
} else { } else {

View File

@@ -14,11 +14,14 @@ import 'package:get_storage/get_storage.dart';
import 'package:localstorage/localstorage.dart'; import 'package:localstorage/localstorage.dart';
import 'package:syncfusion_localizations/syncfusion_localizations.dart'; import 'package:syncfusion_localizations/syncfusion_localizations.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/CheckNetwork.dart'; import 'package:vbvs_app/common/util/CheckNetwork.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart'; import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/Dio.dart'; import 'package:vbvs_app/common/util/Dio.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/requestWithLog.dart'; import 'package:vbvs_app/common/util/requestWithLog.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/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';
@@ -62,10 +65,12 @@ import 'package:vbvs_app/controller/sleep/sleep_report_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/time/countdown_controller.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/controller/weather/weather_controller.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/language/AppLanguage.dart'; import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/model/CustomThemeColor.dart'; import 'package:vbvs_app/model/CustomThemeColor.dart';
import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
import 'package:vbvs_app/pages/mh_page/MattressControl.dart'; import 'package:vbvs_app/pages/mh_page/MattressControl.dart';
import 'package:vbvs_app/pages/mh_page/device/component/mht_device_calibration_controller.dart'; import 'package:vbvs_app/pages/mh_page/device/component/mht_device_calibration_controller.dart';
import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart'; import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart';
@@ -86,10 +91,10 @@ Future<void> main() async {
print('系统语言: ${deviceLocale?.languageCode}'); print('系统语言: ${deviceLocale?.languageCode}');
// final selectapp = "th"; // final selectapp = "th";
final selectapp = "mht"; // final selectapp = "mht";
// await AppLanguage().loadLanguage("en_US"); // await AppLanguage().loadLanguage("en_US");
await loadLanguageSetting(selectapp); await loadLanguageSetting();
await initLanguageSetting(); await initLanguageSetting();
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@@ -102,7 +107,7 @@ Future<void> main() async {
await messageStatus(); await messageStatus();
startMessagePolling(selectapp); startMessagePolling(AppConstants().ent_type);
// 检查网络 // 检查网络
Checknetwork.checkNetwork(); Checknetwork.checkNetwork();
// 微信开放平台注册 // 微信开放平台注册
@@ -119,12 +124,12 @@ Future<void> main() async {
}); });
} }
loadLanguageSetting(String selectapp) async { loadLanguageSetting() async {
await ef.kvdb.openDir("mht"); await ef.kvdb.openDir("mht");
String? language = await ef.kvdb.read("mht/language"); String? language = await ef.kvdb.read("mht/language");
language ??= 'zh_CN'; language ??= 'zh_CN';
await AppLanguage().loadLanguage(language, project: selectapp); await AppLanguage().loadLanguage(language, project: APPPackageType.MHT.code);
} }
void initwebService() { void initwebService() {
@@ -136,11 +141,15 @@ void initwebService() {
}); });
} }
initLanguageSetting() { initLanguageSetting() async {
try { try {
Get.put(MHLanguageController());
MHLanguageController mhLanguageController = Get.find();
await mhLanguageController.initLanuageList();
Get.put(LanguageController()); Get.put(LanguageController());
LanguageController languageController = Get.find(); LanguageController languageController = Get.find();
languageController.initLanuageList(); await languageController.initLanuageList();
} catch (e) { } catch (e) {
print(e); print(e);
} }
@@ -175,9 +184,11 @@ Timer? _messageTimer;
// } // }
// }); // });
// } // }
void startMessagePolling(String selectapp) { void startMessagePolling(int ent_type) {
// Get.put(MhMessageController());
// MhMessageController messageController = Get.find();
_messageTimer?.cancel(); _messageTimer?.cancel();
if (selectapp == 'mht') { if (ent_type == APPPackageType.MHT.code) {
if (Get.isRegistered<MhMessageController>()) { if (Get.isRegistered<MhMessageController>()) {
Get.find<MhMessageController>().getMessageStatus(); Get.find<MhMessageController>().getMessageStatus();
} }
@@ -188,7 +199,7 @@ void startMessagePolling(String selectapp) {
} }
_messageTimer = Timer.periodic(Duration(seconds: 10), (timer) async { _messageTimer = Timer.periodic(Duration(seconds: 10), (timer) async {
try { try {
if (selectapp == 'mht') { if (ent_type == APPPackageType.MHT.code) {
if (Get.isRegistered<MhMessageController>()) { if (Get.isRegistered<MhMessageController>()) {
Get.find<MhMessageController>().getMessageStatus(); Get.find<MhMessageController>().getMessageStatus();
} }
@@ -393,10 +404,10 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => SleepingHabitController()), Get.lazyPut(() => SleepingHabitController()),
Get.lazyPut(() => PeopleInfoController()), Get.lazyPut(() => PeopleInfoController()),
Get.lazyPut(() => MainPageController()), Get.lazyPut(() => MainPageController()),
Get.lazyPut(() => MHLanguageController()), Get.lazyPut(() => MhMessageController()),
Get.lazyPut(() => AddressListController()), Get.lazyPut(() => AddressListController()),
Get.lazyPut(() => AddressController()), Get.lazyPut(() => AddressController()),
Get.lazyPut(() => MHLanguageController()), // Get.lazyPut(() => MHLanguageController()),
Get.lazyPut(() => BlueteethBindController()), Get.lazyPut(() => BlueteethBindController()),
Get.lazyPut(() => BookInfoController()), Get.lazyPut(() => BookInfoController()),
Get.lazyPut(() => PersonController()), Get.lazyPut(() => PersonController()),

View File

@@ -1288,11 +1288,11 @@ Future<void> showDeleteDeviceConfirmDialog({
style: TextStyle(fontSize: 26.rpx, color: Colors.black87), style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
children: [ children: [
TextSpan( TextSpan(
text: '删除后,', text: '删除后,'.tr,
style: style:
TextStyle(color: Colors.red, fontSize: 26.rpx)), TextStyle(color: Colors.red, fontSize: 26.rpx)),
TextSpan( TextSpan(
text: '该设备的历史数据将被清除', text: '该设备的历史数据将被清除'.tr,
style: TextStyle(fontSize: 26.rpx), style: TextStyle(fontSize: 26.rpx),
), ),
], ],
@@ -1319,7 +1319,7 @@ Future<void> showDeleteDeviceConfirmDialog({
height: 90.rpx, height: 90.rpx,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
'取消', '取消'.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, color: Colors.white), fontSize: 26.rpx, color: Colors.white),
), ),
@@ -1340,7 +1340,7 @@ Future<void> showDeleteDeviceConfirmDialog({
height: 90.rpx, height: 90.rpx,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
'删除', '删除'.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, color: Colors.white), fontSize: 26.rpx, color: Colors.white),
), ),
@@ -1361,4 +1361,209 @@ Future<void> showDeleteDeviceConfirmDialog({
)); ));
}, },
); );
//消息弹窗
}
// Future<void> showMessageConfirmDialog({
// required BuildContext context,
// required VoidCallback onConfirm,
// required VoidCallback onCancel,
// required String title,
// }) async {
// await showDialog(
// context: context,
// barrierDismissible: true,
// builder: (BuildContext context) {
// return FrostedDialog(
// blurSigma: 3.0,
// child: Container(
// width: 520.rpx,
// height: 460.rpx,
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(20.0),
// ),
// child: Padding(
// padding: EdgeInsets.only(
// left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// mainAxisSize: MainAxisSize.min,
// children: [
// Text(
// title,
// style: TextStyle(
// fontSize: 30.rpx,
// color: Colors.black,
// ),
// ),
// const SizedBox(height: 12),
// RichText(
// textAlign: TextAlign.center,
// text: TextSpan(
// style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
// children: [
// TextSpan(
// text: '有一条新的设备分享消息,'.tr,
// style:
// TextStyle(color: Colors.red, fontSize: 26.rpx)),
// ],
// ),
// ),
// const SizedBox(height: 24),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// CustomCard(
// gradientDirection: GradientDirection.vertical,
// borderRadius: 16.rpx,
// onTap: () {
// Get.back();
// onCancel();
// },
// colors: [
// Color(0xFF1592AA),
// Color(0XFF0C83A7),
// Color(0XFF006FA3)
// ],
// child: Container(
// width: 200.rpx,
// height: 90.rpx,
// alignment: Alignment.center,
// child: Text(
// '取消'.tr,
// style: TextStyle(
// fontSize: 26.rpx, color: Colors.white),
// ),
// )),
// CustomCard(
// borderRadius: 16.rpx,
// onTap: () {
// Get.back();
// onConfirm();
// },
// colors: [
// Color(0xFF1592AA),
// Color(0XFF0C83A7),
// Color(0XFF006FA3)
// ],
// child: Container(
// width: 200.rpx,
// height: 90.rpx,
// alignment: Alignment.center,
// child: Text(
// '去查看'.tr,
// style: TextStyle(
// fontSize: 26.rpx, color: Colors.white),
// ),
// ))
// ],
// )
// ],
// ),
// ),
// ));
// },
// );
// }
Future<void> showMessageConfirmDialog({
required VoidCallback onConfirm,
required VoidCallback onCancel,
required String title,
}) async {
await Get.dialog(
FrostedDialog(
blurSigma: 3.0,
child: Container(
width: 520.rpx,
height: 460.rpx,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20.0),
),
child: Padding(
padding: EdgeInsets.only(
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: TextStyle(
fontSize: 30.rpx,
color: Colors.black,
),
),
const SizedBox(height: 12),
RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
children: [
TextSpan(
text: '有一条新的设备分享消息,'.tr,
style: TextStyle(color: Colors.red, fontSize: 26.rpx)),
],
),
),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomCard(
gradientDirection: GradientDirection.vertical,
borderRadius: 16.rpx,
onTap: () {
Get.back();
onCancel();
},
colors: [
Color(0xFF1592AA),
Color(0XFF0C83A7),
Color(0XFF006FA3)
],
child: Container(
width: 200.rpx,
height: 90.rpx,
alignment: Alignment.center,
child: Text(
'取消'.tr,
style: TextStyle(fontSize: 26.rpx, color: Colors.white),
),
),
),
CustomCard(
borderRadius: 16.rpx,
onTap: () {
Get.back();
onConfirm();
},
colors: [
Color(0xFF1592AA),
Color(0XFF0C83A7),
Color(0XFF006FA3)
],
child: Container(
width: 200.rpx,
height: 90.rpx,
alignment: Alignment.center,
child: Text(
'去查看'.tr,
style: TextStyle(fontSize: 26.rpx, color: Colors.white),
),
),
)
],
)
],
),
),
),
),
barrierDismissible: true,
// 监听返回或点击遮罩关闭事件
);
} }

View File

@@ -138,7 +138,6 @@ class _HomePageState extends State<MainPageBBottomChange>
DateTime? _lastBackPressedTime; // 记录上一次返回的时间 DateTime? _lastBackPressedTime; // 记录上一次返回的时间
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Obx(() { return Obx(() {
final currentLanguage = final currentLanguage =
languageController.selectLanguage.value; // 监听此变量变化 languageController.selectLanguage.value; // 监听此变量变化

View File

@@ -82,42 +82,7 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
// ClickableContainer(
// backgroundColor:
// Colors.transparent, // 容器背景色
// highlightColor: themeController
// .currentColor.sc21, // 点击时的背景色
// padding: EdgeInsets
// .zero, // 这里去掉外部的 padding避免影响点击范围
// onTap: () async {
// if (userInfoController.model.login ==
// LoginStatus.LOGIN.code) {
// // TopSlideNotification.show(
// // context,
// // text: "待开发功能".tr,
// // );
// await loginController.openWeChatCustomerService(context);
// } else {
// TopSlideNotification.show(
// context,
// text: "必须登录提示".tr,
// textColor:
// themeController.currentColor.sc9,
// );
// Get.toNamed("/loginPage");
// }
// },
// child: Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 0.rpx, 0.rpx, 0.rpx, 0.rpx),
// child: SvgPicture.asset(
// 'assets/img/icon/earphone.svg',
// width: 29.rpx,
// height: 29.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
// color: themeController.currentColor.sc3,
// ),
// ),
// ),
ClickableContainer( ClickableContainer(
backgroundColor: backgroundColor:

View File

@@ -8,6 +8,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart'; import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/language/AppLanguage.dart'; import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.dart'; import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.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';
@@ -127,7 +128,8 @@ class _LanguagePageState extends State<LanguagePage> {
await AppLanguage() await AppLanguage()
.loadLanguage( .loadLanguage(
language.language_code, language.language_code,
project: "mht"); // 加载语言 project: AppConstants()
.ent_type); // 加载语言
languageController languageController
.updateAll(); // 更新操作 .updateAll(); // 更新操作
languageController languageController
@@ -179,41 +181,43 @@ class _LanguagePageState extends State<LanguagePage> {
false, // 根据 selected 状态显示选中或未选中 false, // 根据 selected 状态显示选中或未选中
onChanged: (value) async { onChanged: (value) async {
// // 保持原有的状态更改逻辑 // // 保持原有的状态更改逻辑
// for (var lang // 点击事件逻辑
// in languageController for (var lang
// .languageList) { in languageController
// lang.selected = (lang == .languageList) {
// language); // 更新选中状态 lang.selected = (lang ==
// } language); // 根据选择更新状态
}
// await AppLanguage() await AppLanguage().loadLanguage(
// .loadLanguage( language
// language .language_code,
// .language_code, project: AppConstants()
// project: .ent_type); // 加载语言
// "mht"); // 加载语言 languageController
// languageController .updateAll(); // 更新操作
// .updateAll(); // 更新操作 languageController
// languageController .selectLanguage
// .selectLanguage .value = language;
// .value = language; final list =
// final list = deviceController
// deviceController .personnelList
// .personnelList .value;
// .value; deviceController
// deviceController .getHomeSleeps(
// .getHomeSleeps( list[0]["mac"],
// list[0]["mac"], context);
// context);
// final box = GetStorage(); try {
// try { // ef.kv.set("language",
// box.write( // language.language_code);
// 'language', ef.kvdb.write(
// language "mht/language",
// .language_code); language
// } catch (e) { .language_code);
// print(e); } catch (e) {
// } print(e);
}
}, },
), ),
].divide(SizedBox( ].divide(SizedBox(

View File

@@ -143,6 +143,8 @@ class ShareDeviceDetailWidget extends GetView {
} catch (e) { } catch (e) {
ef.log("[h5]通知列表更新错误:$e"); ef.log("[h5]通知列表更新错误:$e");
} }
isProgrammaticPop = true; // 设置为程序触发,避免再次触发 PopScope
Get.back(); // 或 Navigator.pop(context);
}, },
onFailure: (res) { onFailure: (res) {
TopSlideNotification.show(context, TopSlideNotification.show(context,
@@ -152,12 +154,12 @@ class ShareDeviceDetailWidget extends GetView {
} catch (e) { } catch (e) {
print(e); print(e);
} }
if (Platform.isAndroid) { // if (Platform.isAndroid) {
var flag = await _handleBackPressed(context); // 自定义返回逻辑 // var flag = await _handleBackPressed(context); // 自定义返回逻辑
if (flag) { // if (flag) {
SystemNavigator.pop(); // SystemNavigator.pop();
} // }
} // }
}, },
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
@@ -423,7 +425,9 @@ class ShareDeviceDetailWidget extends GetView {
gradientDirection: GradientDirection.vertical, gradientDirection: GradientDirection.vertical,
onTap: () async { onTap: () async {
deviceListController.unbindShareDevice( deviceListController.unbindShareDevice(
data['info'][5]['uid'], data['mac'.tr], context); data['info'][5]['uid'],
data['mac'.tr],
context);
}, },
colors: const [ colors: const [
Color(0xFFFCFCFC), Color(0xFFFCFCFC),
@@ -456,20 +460,4 @@ class ShareDeviceDetailWidget extends GetView {
), ),
)); ));
} }
Future<bool> _handleBackPressed(BuildContext context) async {
final currentTime = DateTime.now();
// 如果上次点击返回键时间为空,或者间隔超过 1 秒
if (_lastBackPressedTime == null ||
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
_lastBackPressedTime = currentTime;
TopSlideNotification.show(
context,
text: "再按一次退出程序".tr,
);
return false; // 阻止退出程序
} else {
return true; // 允许退出程序
}
}
} }

View File

@@ -21,45 +21,47 @@ class AddressModuleWidget extends GetView {
child: SlidableAutoCloseBehavior( child: SlidableAutoCloseBehavior(
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0), padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Container( child: Slidable(
width: MediaQuery.sizeOf(context).width, key:
constraints: BoxConstraints( ValueKey(addressListController.model.addressList[index]['_id']),
minHeight: 220.rpx, endActionPane: ActionPane(
), extentRatio: 0.26,
decoration: BoxDecoration( motion: ScrollMotion(),
color: Color(0xFF003058), children: [
borderRadius: BorderRadius.circular(16), Expanded(
), child: InkWell(
child: Slidable( onTap: () async {
endActionPane: ActionPane( await addressListController.deleteAddress(
extentRatio: 0.26, addressListController.model.addressList[index]
motion: ScrollMotion(), ['_id']);
children: [ addressListController.model.addressList.removeAt(index);
Expanded(
child: InkWell(
onTap: () async {
await addressListController.deleteAddress(
addressListController.model.addressList[index]
['_id']);
addressListController.model.addressList.removeAt(index);
addressListController.updateAll(); addressListController.updateAll();
}, },
child: Container( child: Container(
margin: EdgeInsets.only(left: 30), margin: EdgeInsets.only(left: 30),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
color: Colors.red, color: Colors.red,
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: Icon( child: Icon(
Icons.delete, Icons.delete,
color: Colors.white, color: Colors.white,
),
), ),
), ),
) ),
], )
],
),
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints(
minHeight: 220.rpx,
),
decoration: BoxDecoration(
color: Color(0xFF003058),
borderRadius: BorderRadius.circular(16),
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(

View File

@@ -299,7 +299,6 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
.firstWhere((device) => .firstWhere((device) =>
device['mac'.tr].toString() == device['mac'.tr].toString() ==
val); val);
final mac = final mac =
selectedDevice['mac'.tr]?.toString() ?? selectedDevice['mac'.tr]?.toString() ??
'未知MAC'.tr; '未知MAC'.tr;
@@ -374,12 +373,11 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
0, 0,
borderRadius: borderRadius:
8, 8,
margin: const EdgeInsetsDirectional margin: EdgeInsetsDirectional.fromSTEB(
.fromSTEB( 20.rpx,
10, 8.rpx,
4, 20.rpx,
10, 4.rpx),
4),
hidesUnderline: hidesUnderline:
true, true,
isOverButton: isOverButton:
@@ -418,7 +416,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
0.038, 0.038,
constraints: constraints:
BoxConstraints( BoxConstraints(
minWidth: 62, minWidth: 60,
), ),
child: Align( child: Align(
alignment: alignment:
@@ -457,7 +455,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
padding: padding:
EdgeInsetsDirectional EdgeInsetsDirectional
.fromSTEB( .fromSTEB(
35.rpx, 20.rpx,
0, 0,
35.rpx, 35.rpx,
0), 0),
@@ -493,7 +491,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
contentPadding: contentPadding:
EdgeInsets.all(0), EdgeInsets.all(0),
isDense: isDense:
true, false,
labelStyle: labelStyle:
TextStyle( TextStyle(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -595,7 +593,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
.height * .height *
0.038, 0.038,
constraints: constraints:
const BoxConstraints( BoxConstraints(
minWidth: 60, minWidth: 60,
), ),
child: Align( child: Align(
@@ -634,7 +632,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
padding: padding:
EdgeInsetsDirectional EdgeInsetsDirectional
.fromSTEB( .fromSTEB(
35.rpx, 20.rpx,
0, 0,
35.rpx, 35.rpx,
0), 0),
@@ -670,7 +668,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
contentPadding: contentPadding:
EdgeInsets.all(0), EdgeInsets.all(0),
isDense: isDense:
true, false,
labelStyle: labelStyle:
TextStyle( TextStyle(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -812,7 +810,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
padding: padding:
EdgeInsetsDirectional EdgeInsetsDirectional
.fromSTEB( .fromSTEB(
35.rpx, 20.rpx,
0, 0,
35.rpx, 35.rpx,
0), 0),
@@ -848,7 +846,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
contentPadding: contentPadding:
EdgeInsets.all(0), EdgeInsets.all(0),
isDense: isDense:
true, false,
labelStyle: labelStyle:
TextStyle( TextStyle(
fontFamily: 'Inter', fontFamily: 'Inter',
@@ -1042,8 +1040,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
), ),
Flexible( Flexible(
child: Container( child: Container(
width: 138, width: 300.rpx,
height: 31, height: 62.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius BorderRadius

View File

@@ -141,9 +141,9 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
} }
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
queryUrl += "&lang=$language"; queryUrl += "&lang=$language";

View File

@@ -37,6 +37,11 @@ class _EditBedPageState extends State<EditBedPage> {
super.initState(); super.initState();
editedData = Map.from(widget.data); // 创建副本 editedData = Map.from(widget.data); // 创建副本
_nameController = TextEditingController(text: editedData['name']); _nameController = TextEditingController(text: editedData['name']);
// 添加监听器
_nameController.addListener(() {
setState(() {}); // 每次文字变化刷新UI
});
} }
@override @override
@@ -181,84 +186,178 @@ class _EditBedPageState extends State<EditBedPage> {
height: 193.rpx, height: 193.rpx,
), ),
Padding( Padding(
padding: padding:
EdgeInsets.symmetric(horizontal: 60.rpx), EdgeInsets.symmetric(horizontal: 60.rpx),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
height: bodysize!.maxHeight * 0.076, height: bodysize!.maxHeight * 0.076,
decoration: const BoxDecoration( decoration: const BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Color(0xFF929699), color: Color(0xFF929699), // 灰色底部线
width: 0))), width: 0.5, // 根据需要设置宽度
child: TextFormField(
// autofocus: true,
controller: _nameController,
obscureText: false,
onChanged: (val) {
editedData['name'] = val;
},
textAlign: TextAlign.center,
maxLength: AppConstants().text_length,
decoration: InputDecoration(
hintText: "请输入设备的名称".tr,
contentPadding:
const EdgeInsetsDirectional
.fromSTEB(10, 0, 10, 0),
labelStyle: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
fontSize: 36.rpx, // 设置输入文字大小
color: Colors.white, // 设置输入文字颜色
),
hintStyle: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
color: Color(0xFF929699),
fontSize: 36.rpx,
),
enabledBorder: UnderlineInputBorder(
borderSide: const BorderSide(
color: Color(0x00000000),
width: 2,
),
borderRadius:
BorderRadius.circular(8),
),
focusedBorder: UnderlineInputBorder(
borderSide: const BorderSide(
color: Color(0x00000000),
width: 2,
),
borderRadius:
BorderRadius.circular(8),
),
errorBorder: UnderlineInputBorder(
borderSide: const BorderSide(
color: Color(0x00000000),
width: 2,
),
borderRadius:
BorderRadius.circular(8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide: const BorderSide(
color: Color(0x00000000),
width: 2,
),
borderRadius:
BorderRadius.circular(8),
),
),
style: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
color: Colors.white,
fontSize: 36.rpx,
), ),
), ),
)) ),
child: Stack(
children: [
TextFormField(
controller: _nameController,
obscureText: false,
onChanged: (val) {
editedData['name'] = val;
},
textAlign: TextAlign.center,
textAlignVertical:
TextAlignVertical.center,
maxLength: AppConstants().text_length,
buildCounter: (_,
{int? currentLength,
bool? isFocused,
int? maxLength}) =>
null,
decoration: InputDecoration(
hintText: "请输入设备的名称".tr,
contentPadding:
const EdgeInsets.symmetric(
vertical: 0, horizontal: 10),
labelStyle: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
fontSize: 36.rpx,
color: Colors.white,
),
hintStyle: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
fontSize: 36.rpx,
color: const Color(0xFF929699),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.circular(8),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.circular(8),
),
errorBorder: UnderlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.circular(8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide: BorderSide.none,
borderRadius:
BorderRadius.circular(8),
),
),
style: TextStyle(
fontFamily: 'Readex Pro',
fontSize: 36.rpx,
color: Colors.white,
letterSpacing: 0,
),
cursorColor: Colors.white,
),
// 自定义右下角计数器
Positioned(
bottom: 2.rpx,
right: 10.rpx,
child: Text(
'${_nameController.text.characters.length} / ${AppConstants().text_length}',
style: TextStyle(
fontSize: 24.rpx,
color: const Color(0xFF929699),
fontFamily: 'Readex Pro',
),
),
),
],
),
),
// Container(
// alignment: Alignment.center,
// height: bodysize!.maxHeight * 0.076,
// decoration: const BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Color(0xFF929699),
// width: 0))),
// child: TextFormField(
// // autofocus: true,
// controller: _nameController,
// obscureText: false,
// onChanged: (val) {
// editedData['name'] = val;
// },
// textAlign: TextAlign.center,
// maxLength: AppConstants().text_length,
// decoration: InputDecoration(
// hintText: "请输入设备的名称".tr,
// contentPadding:
// const EdgeInsetsDirectional
// .fromSTEB(10, 0, 10, 0),
// labelStyle: TextStyle(
// fontFamily: 'Readex Pro',
// letterSpacing: 0,
// fontSize: 36.rpx, // 设置输入文字大小
// color: Colors.white, // 设置输入文字颜色
// ),
// hintStyle: TextStyle(
// fontFamily: 'Readex Pro',
// letterSpacing: 0,
// color: Color(0xFF929699),
// fontSize: 36.rpx,
// ),
// enabledBorder: UnderlineInputBorder(
// borderSide: const BorderSide(
// color: Color(0x00000000),
// width: 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// focusedBorder: UnderlineInputBorder(
// borderSide: const BorderSide(
// color: Color(0x00000000),
// width: 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// errorBorder: UnderlineInputBorder(
// borderSide: const BorderSide(
// color: Color(0x00000000),
// width: 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// focusedErrorBorder:
// UnderlineInputBorder(
// borderSide: const BorderSide(
// color: Color(0x00000000),
// width: 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// ),
// style: TextStyle(
// fontFamily: 'Readex Pro',
// letterSpacing: 0,
// color: Colors.white,
// fontSize: 36.rpx,
// ),
// ),
// )
)
], ],
), ),
), ),

View File

@@ -37,6 +37,7 @@ class ExperienceStoreWidget extends GetView {
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 4), padding: const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 4),

View File

@@ -61,14 +61,16 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
Future<ApiResponse> getDeviceNum() async { Future<ApiResponse> getDeviceNum() async {
try { try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
String serviceAddress = ServiceConstant.service_address; String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service; String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list; String serviceApi = ServiceConstant.device_list;
String queryUrl = String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?bindNum=1"; "${serviceAddress}${serviceName}${serviceApi}?bindNum=1";
String? language = ""; String? language = "";
language = languageController.selectLanguage.value!.language_code; if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
queryUrl += "&lang=$language"; queryUrl += "&lang=$language";
@@ -80,7 +82,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
var responseData = var responseData =
response.data is String ? jsonDecode(response.data) : response.data; response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res = ApiResponse.fromJson(responseData, (object) => object); ApiResponse res = ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr); MyUtils.formatResponse(res, "设备列表请求成功".tr, "设备列表请求失败".tr);
if (res.code == HttpStatusCodes.ok) { if (res.code == HttpStatusCodes.ok) {
bindDeviceNum.value = res.total!; bindDeviceNum.value = res.total!;
updateAll(); updateAll();
@@ -97,7 +99,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
Future<ApiResponse> getDeviceList( Future<ApiResponse> getDeviceList(
{String? key, String? group, int? bindType}) async { {String? key, String? group, int? bindType}) async {
try { try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
String serviceAddress = ServiceConstant.service_address; String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service; String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list; String serviceApi = ServiceConstant.device_list;
@@ -121,7 +123,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
} }
String? language = ""; String? language = "";
language = languageController.selectLanguage.value!.language_code; if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
queryParams['lang'] = language; queryParams['lang'] = language;
} }
@@ -135,7 +139,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
var responseData = var responseData =
response.data is String ? jsonDecode(response.data) : response.data; response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res = ApiResponse.fromJson(responseData, (object) => object); ApiResponse res = ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr); MyUtils.formatResponse(res, "设备列表请求成功".tr, "设备列表请求失败".tr);
if (res.code == HttpStatusCodes.ok) { if (res.code == HttpStatusCodes.ok) {
deviceList.value = res.data!; deviceList.value = res.data!;
updateAll(); updateAll();
@@ -152,7 +156,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
Future<ApiResponse> getDeviceListForWeb( Future<ApiResponse> getDeviceListForWeb(
{String? key, String? group, int? bindType}) async { {String? key, String? group, int? bindType}) async {
try { try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
String serviceAddress = ServiceConstant.service_address; String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service; String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list; String serviceApi = ServiceConstant.device_list;
@@ -176,8 +180,8 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
} }
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
queryParams['lang'] = language; queryParams['lang'] = language;
@@ -194,14 +198,14 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
response.data is String ? jsonDecode(response.data) : response.data; response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res = ApiResponse res =
ApiResponse.fromJson(responseData, (object) => object); ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr); MyUtils.formatResponse(res, "设备列表请求成功".tr, "设备列表请求失败".tr);
if (res.code == HttpStatusCodes.ok) { if (res.code == HttpStatusCodes.ok) {
deviceListForWeb.value = res.data!; deviceListForWeb.value = res.data!;
updateAll(); updateAll();
return res; return res;
} }
} else { } else {
return ApiResponse(code: -1, msg: "服务器.失败".tr); return ApiResponse(code: -1, msg: "失败".tr);
} }
return apiResponse; return apiResponse;
} catch (e) { } catch (e) {
@@ -219,8 +223,8 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
String serviceApi = ServiceConstant.device_bind; String serviceApi = ServiceConstant.device_bind;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
@@ -355,8 +359,8 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
String serviceApi = ServiceConstant.device_show; String serviceApi = ServiceConstant.device_show;
String queryUrl = "$serviceAddress$serviceName$serviceApi"; String queryUrl = "$serviceAddress$serviceName$serviceApi";
String? language = ""; String? language = "";
if (languageController.selectLanguage != null) { if (mhLanguageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code; language = mhLanguageController.selectLanguage.value!.language_code;
} }
if (language != null && language.isNotEmpty) { if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) { if (queryUrl.contains("?")) {
@@ -393,7 +397,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
//查询人员信息列表 //查询人员信息列表
Future<void> getPersonList() async { Future<void> getPersonList() async {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
String serviceAddress = ServiceConstant.service_address; String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service; String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.personnel_info; String serviceApi = ServiceConstant.personnel_info;

View File

@@ -204,21 +204,21 @@ class _NewHomePageState extends State<NewHomePage> {
child: userInfo(userInfoController.model.login), child: userInfo(userInfoController.model.login),
); );
}), }),
const Spacer(), // 左右分隔 // const Spacer(), // 左右分隔
FloatingSvgIcon( // FloatingSvgIcon(
assetPath: 'assets/img/icon/xiaoyi.svg', // assetPath: 'assets/img/icon/xiaoyi.svg',
width: 60.rpx, // width: 60.rpx,
height: 60.rpx, // height: 60.rpx,
onTap: () { // onTap: () {
// print("点击了小鹅图标"); // // print("点击了小鹅图标");
if (userInfoController.model.login == 0) { // if (userInfoController.model.login == 0) {
Get.toNamed("/loginPage"); // Get.toNamed("/loginPage");
} // }
Get.toNamed("/xiaoEPage", // Get.toNamed("/xiaoEPage",
arguments: // arguments:
"https://xiaoe.he-info.cn/?mac=b43a45c3ddf4"); // "https://xiaoe.he-info.cn/?mac=b43a45c3ddf4");
}, // },
), // ),
SizedBox(width: 40.rpx), SizedBox(width: 40.rpx),
], ],
), ),
@@ -441,8 +441,8 @@ class _NewHomePageState extends State<NewHomePage> {
deviceController deviceController
.personnelList.value .personnelList.value
.map<String>((d) { .map<String>((d) {
var s = d["name"] ?? var s =
d["mac"]; d["name"] ?? d["mac"];
if (s == null) { if (s == null) {
return ""; return "";
} else { } else {

View File

@@ -12,23 +12,13 @@ class IssueListPage extends GetView<IssueListController> {
BoxConstraints? bodysize; BoxConstraints? bodysize;
IssueListController controller = Get.put(IssueListController()); IssueListController controller = Get.put(IssueListController());
// ScrollController scrollController = ScrollController(); fetchData() async {
// IssueListPage() { await controller.getIssueList();
// controller.model.issueList!.clear(); }
// controller.initData();
// scrollController.addListener(() {
// if (scrollController.position.pixels ==
// scrollController.position.maxScrollExtent &&
// controller.model.hasMore) {
// controller.initData();
// controller.updateAll();
// }
// });
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
fetchData();
return LayoutBuilder(builder: (context, cc) { return LayoutBuilder(builder: (context, cc) {
bodysize = cc; bodysize = cc;
return GestureDetector( return GestureDetector(

View File

@@ -18,94 +18,80 @@ class IssuePreviewWidget extends GetView<IssuePreviewInfoController> {
required this.issueListController, required this.issueListController,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return Container(
onTap: () async { margin: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
// issueListController.model.selectedIndex = index; child: InkWell(
// issueListController.updateAll(); onTap: () async {
// await Future.delayed(Duration(milliseconds: 100)); var article = issueListController.model.issueList![index];
// issueListController.model.selectedIndex = -1; Get.toNamed("/helpArticle", arguments: article);
// issueListController.updateAll(); },
var article = issueListController.model.issueList![index]; child: Obx(() {
Get.toNamed("/helpArticle", arguments: article); return Container(
// TopSlideNotification.show( alignment: Alignment.center,
// context, width: double.infinity,
// text: "功能开发中...", constraints: BoxConstraints(minHeight: 119.rpx),
// ); decoration: BoxDecoration(
}, color: index == issueListController.model.selectedIndex
child: Obx(() { ? Colors.grey[300]
return Container( : Colors.transparent,
margin: EdgeInsets.only(left: 30.rpx, right: 30.rpx), border: Border(
alignment: Alignment.center, bottom:
width: double.infinity, BorderSide(color: const Color(0xFF929699), width: 0.rpx),
constraints: BoxConstraints( ),
// minWidth: 100,
minHeight: 119.rpx,
),
decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(0),
// 整行的背景颜色
color: index == issueListController.model.selectedIndex
? Colors.grey[300]
: Colors.transparent,
border: Border(
bottom: BorderSide(color: const Color(0xFF929699), width: 0.rpx),
), ),
), child: Padding(
child: Padding( padding: EdgeInsetsDirectional.fromSTEB(16.rpx, 0, 41.rpx, 0),
padding: EdgeInsetsDirectional.fromSTEB(16.rpx, 0, 41.rpx, 0), child: Row(
child: Row( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ Flexible(
Flexible( flex: 9,
flex: 9, child: Align(
child: Align( alignment: AlignmentDirectional(-1, -1),
alignment: AlignmentDirectional(-1, -1), child: Text(
child: Text( issueListController.model.issueList![index]['title'] ??
issueListController.model.issueList![index]['title'] ?? '',
'', style: TextStyle(
style: TextStyle( fontFamily: 'Readex Pro',
fontFamily: 'Readex Pro', color: Color(0xFFFFFFFF),
color: Color(0xFFFFFFFF), fontSize: AppFontsize.title_size,
fontSize: AppFontsize.title_size, letterSpacing: 0,
letterSpacing: 0, ),
// height: 1,
), ),
), ),
), ),
), Expanded(
Expanded( flex: 1,
flex: 1, child: Align(
child: Align( alignment: Alignment.centerRight,
alignment: Alignment.centerRight, child: ClickableContainer(
child: ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
padding: EdgeInsets.only(right: 0), padding: EdgeInsets.only(right: 0),
onTap: () {}, onTap: () {},
child: Container( child: Container(
height: 30.rpx, height: 30.rpx,
width: 30.rpx, width: 30.rpx,
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/expand.svg', 'assets/img/icon/expand.svg',
color: Colors.white, color: Colors.white,
) ),
// Icon( ),
// Icons.arrow_forward_ios, ),
// color: Colors.white, ),
// // size: 14.rpx,
// ),
)),
), ),
), ],
], ),
), ),
), );
); }),
}), ),
); );
} }
} }

View File

@@ -24,7 +24,7 @@ class MessageDetailPage extends StatefulWidget {
class _MessageDetailPageState extends State<MessageDetailPage> { class _MessageDetailPageState extends State<MessageDetailPage> {
MHDeviceShareController controller = Get.find(); MHDeviceShareController controller = Get.find();
MhMessageController messageController = Get.find(); MhMessageController messageController = Get.find();
RxInt status = 0.obs; RxInt status = 1.obs;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
status.value = widget.data['status']; status.value = widget.data['status'];
@@ -158,7 +158,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
))), ))),
), ),
const Spacer(), const Spacer(),
bottomIcon(context) bottomIcon(context, messageInfo)
], ],
)), )),
), ),
@@ -167,7 +167,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
)); ));
} }
Container bottomIcon(BuildContext context) { Container bottomIcon(BuildContext context, var messageInfo) {
return Container( return Container(
height: 120.rpx, height: 120.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -182,8 +182,11 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
if (apiResponse.code == HttpStatusCodes.ok) { if (apiResponse.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: apiResponse.msg!, textColor: Color(0xFF00C1AA)); text: apiResponse.msg!, textColor: Color(0xFF00C1AA));
messageController.getMessageList(widget.data['type']); messageController.updateMessageReadStatus(
messageController.updateAll(); context, messageInfo['type'],
mid: messageInfo['_id']);
// messageController.getMessageList(widget.data['type']);
// messageController.updateAll();
//todo 更新设备列表 //todo 更新设备列表
MHTHomeController homeController = Get.find(); MHTHomeController homeController = Get.find();
//更新设备列表 //更新设备列表
@@ -230,6 +233,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
messageController.getMessageList(widget.data['type']); messageController.getMessageList(widget.data['type']);
messageController.updateAll(); messageController.updateAll();
} }
status.value = 2;
} }
}, },
child: Obx(() => Text( child: Obx(() => Text(

View File

@@ -31,43 +31,6 @@ class _MinePageState extends State<NewMinePage> {
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
MhMessageController messageController = Get.find(); MhMessageController messageController = Get.find();
// final GlobalKey _textKey = GlobalKey();
// double _textHalfWidth = 0;
// @override
// void initState() {
// super.initState();
// final login = userInfoController.model.login;
// String text;
// if (login == 0) {
// text = '未命名'.tr;
// } else {
// final nickname = userInfoController.model.user?.nick_name;
// text = (nickname != null && nickname.isNotEmpty) ? nickname : '未命名'.tr;
// }
// _calculateTextHalfWidth(text);
// }
// void _calculateTextHalfWidth(String text) {
// final textSpan = TextSpan(
// text: text,
// style: TextStyle(
// fontSize: 30.rpx,
// height: 1,
// ),
// );
// final textPainter = TextPainter(
// text: textSpan,
// textDirection: ui.TextDirection.ltr,
// );
// textPainter.layout(); // 计算文本宽度
// setState(() {
// _textHalfWidth = textPainter.width / 2;
// });
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -100,29 +63,35 @@ class _MinePageState extends State<NewMinePage> {
return ClickableContainer( return ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
padding: EdgeInsets.only(right: 38.rpx), padding: EdgeInsets.only(right: 20.rpx),
onTap: () { onTap: () {
Get.toNamed('/messagePage'); Get.toNamed('/messagePage');
}, },
child: Stack( child: Stack(
clipBehavior: Clip.none, clipBehavior: Clip.none,
children: [ children: [
// 扩大点击区域但不影响SVG图标尺寸
Container( Container(
height: 42.rpx, width: 60.rpx, // 比图标大
width: 42.rpx, height: 60.rpx,
child: SvgPicture.asset( alignment: Alignment.center,
'assets/img/icon/message.svg', child: Container(
color: Colors.white, width: 42.rpx,
height: 42.rpx,
child: SvgPicture.asset(
'assets/img/icon/message.svg',
color: Colors.white,
),
), ),
), ),
if (messageController.model.body_message_read == 1 || if (messageController.model.body_message_read == 1 ||
messageController.model.system_message_read == 1) messageController.model.system_message_read == 1)
Positioned( Positioned(
top: 4.rpx, top: 8.rpx,
right: -10.rpx, right: -1.rpx,
child: Container( child: Container(
width: 12.rpx, width: 14.rpx,
height: 12.rpx, height: 14.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.red, color: Colors.red,
shape: BoxShape.circle, shape: BoxShape.circle,
@@ -143,11 +112,12 @@ class _MinePageState extends State<NewMinePage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 30.rpx, left: 60.rpx, bottom: 190.rpx), top: 30.rpx, left: 60.rpx, bottom: 190.rpx),
child: Row( child: Row(
children: [ children: [
Container( Obx(() {
return Container(
width: 120.rpx, width: 120.rpx,
height: 120.rpx, height: 120.rpx,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
@@ -172,111 +142,110 @@ class _MinePageState extends State<NewMinePage> {
"assets/images/mine_avatar.png", "assets/images/mine_avatar.png",
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), );
Flexible( }),
child: Column( Flexible(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Row( children: [
children: [ Row(
Text( children: [
login == 1 Text(
? (userInfoController login == 1
.model.user!.nick_name ?? ? (userInfoController
'未命名'.tr) .model.user!.nick_name ??
: "未命名".tr, '未命名'.tr)
style: TextStyle( : "未命名".tr,
fontFamily: 'Inter', style: TextStyle(
color: themeController.currentColor.sc3, fontFamily: 'Inter',
fontSize: color: themeController.currentColor.sc3,
AppConstants().title_text_fontSize, fontSize:
letterSpacing: 0.0, AppConstants().title_text_fontSize,
), letterSpacing: 0.0,
), ),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: const Color(0xFF055466),
padding: EdgeInsets.zero,
onTap: () async {
if (userInfoController.model.login ==
null ||
userInfoController.model.login ==
0) {
TopSlideNotification.show(
context,
text: "必须登录提示".tr,
textColor: themeController
.currentColor.sc9,
);
Get.toNamed("/loginPage");
return;
}
await Get.toNamed(
"/editUserInfoPage");
await userInfoController
.getUserInfo();
userInfoController.updateAll();
final login =
userInfoController.model.login;
String text;
if (login == 0) {
text = '未命名'.tr;
} else {
final nickname = userInfoController
.model.user?.nick_name;
text = (nickname != null &&
nickname.isNotEmpty)
? nickname
: '未命名'.tr;
}
},
child: Container(
width: 42.rpx,
height: 42.rpx,
alignment: Alignment.center,
child: SvgPicture.asset(
'assets/images/edit.svg',
color: Colors.white,
width: 18.rpx,
height: 18.rpx,
),
)),
].divide(SizedBox(
width: 20.rpx,
)),
),
Text(
login == 1
? (() {
final user =
userInfoController.model.user!;
if (user.email != null &&
user.email!.isNotEmpty) {
return user.email!;
} else if (user.phone != null &&
user.phone!.isNotEmpty) {
return MyUtils.hidePhoneNumber(
user.phone!);
} else {
return "微信用户".tr;
}
})()
: "未知数据".tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
), ),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: const Color(0xFF055466),
padding: EdgeInsets.zero,
onTap: () async {
if (userInfoController.model.login ==
null ||
userInfoController.model.login ==
0) {
TopSlideNotification.show(
context,
text: "必须登录提示".tr,
textColor: themeController
.currentColor.sc9,
);
Get.toNamed("/loginPage");
return;
}
await Get.toNamed("/editUserInfoPage");
await userInfoController.getUserInfo();
userInfoController.updateAll();
final login =
userInfoController.model.login;
String text;
if (login == 0) {
text = '未命名'.tr;
} else {
final nickname = userInfoController
.model.user?.nick_name;
text = (nickname != null &&
nickname.isNotEmpty)
? nickname
: '未命名'.tr;
}
},
child: Container(
width: 42.rpx,
height: 42.rpx,
alignment: Alignment.center,
child: SvgPicture.asset(
'assets/images/edit.svg',
color: Colors.white,
width: 18.rpx,
height: 18.rpx,
),
)),
].divide(SizedBox(
width: 20.rpx,
)),
),
Text(
login == 1
? (() {
final user =
userInfoController.model.user!;
if (user.email != null &&
user.email!.isNotEmpty) {
return user.email!;
} else if (user.phone != null &&
user.phone!.isNotEmpty) {
return MyUtils.hidePhoneNumber(
user.phone!);
} else {
return "微信用户".tr;
}
})()
: "未知数据".tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
), ),
], ),
)) ],
].divide(SizedBox( ))
width: 30.rpx, ].divide(SizedBox(
)), width: 30.rpx,
)), )),
),
),
Expanded( Expanded(
child: Container( child: Container(
@@ -304,15 +273,15 @@ class _MinePageState extends State<NewMinePage> {
'当您的智能设备需要报修时,可以通过该功能联系解决,'.tr, '当您的智能设备需要报修时,可以通过该功能联系解决,'.tr,
path: '/deviceRepairPage', path: '/deviceRepairPage',
), ),
_buildListTile('assets/img/icon/mall.svg', '网上商城'.tr, _buildListTile('assets/img/icon/mall.svg',
'最新的智能产品线上购买服务'.tr, '网上商城'.tr, '最新的智能产品线上购买服务'.tr, path: "",
path: "", onTap: () { onTap: () {
JDLauncher.openShop( JDLauncher.openShop(
"https://mall.jd.com/index-14587480.html"); "https://mall.jd.com/index-14587480.html");
}), }),
_buildListTile('assets/img/icon/address.svg', // _buildListTile('assets/img/icon/address.svg',
'地址管理'.tr, '用于收货和报修时联系您'.tr, // '地址管理'.tr, '用于收货和报修时联系您'.tr,
path: "/addressListPage"), // path: "/addressListPage"),
_buildListTile('assets/img/icon/help.svg', _buildListTile('assets/img/icon/help.svg',
'问题与帮助'.tr, '常见的问题汇总,如:智能床连接流程、如何查看睡眠报告'.tr, '问题与帮助'.tr, '常见的问题汇总,如:智能床连接流程、如何查看睡眠报告'.tr,
path: "/issueListpage"), path: "/issueListpage"),
@@ -474,8 +443,8 @@ class _MinePageState extends State<NewMinePage> {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.rpx)), borderRadius: BorderRadius.circular(10.rpx)),
), ),
child: child: Text('设置'.tr,
Text('设置'.tr, style: TextStyle(fontSize: 26.rpx, color: Colors.white)), style: TextStyle(fontSize: 26.rpx, color: Colors.white)),
), ),
); );
} }

View File

@@ -98,7 +98,7 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
34.rpx, 10, 0, 0), 34.rpx, 10, 0, 35.rpx),
child: Container( child: Container(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: Column( child: Column(
@@ -230,23 +230,23 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
Padding( Padding(
padding: padding:
const EdgeInsetsDirectional const EdgeInsetsDirectional
.fromSTEB(0, 10, 0, 24), .fromSTEB(0, 10, 0, 0),
child: Container( child: Container(
width: width:
MediaQuery.sizeOf(context) MediaQuery.sizeOf(context)
.width, .width,
height: // height:
MediaQuery.sizeOf(context) // MediaQuery.sizeOf(context)
.height * // .height *
0.15, // 0.15,
constraints: constraints:
const BoxConstraints( const BoxConstraints(
// minHeight: 140, // minHeight: 140,
), ),
child: Container( child: Container(
width: 100, width: 90,
height: 100, height: 90,
child: ListView( child: ListView(
shrinkWrap: true, shrinkWrap: true,
scrollDirection: scrollDirection:
@@ -333,7 +333,8 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
thickness: 1, // 线条厚度 thickness: 1, // 线条厚度
), ),
endChild: Padding( endChild: Padding(
padding: const EdgeInsets.all(8.0), padding: EdgeInsets.only(
left: 10.rpx, top: 2.rpx),
child: RepairStatusWidget( child: RepairStatusWidget(
data: data['flow'][index]), data: data['flow'][index]),
), ),
@@ -649,24 +650,36 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
}); });
} }
// List<Widget> getImage(List<dynamic> imgurl) {
// List<Widget> images = [];
// ApplyRepairController controller = Get.find();
// imgurl!.forEach((element) async {
// images.add(
// Container(
// child: ImgPreviewWidget(
// imgUrl: element,
// index: imgurl!.indexOf(element),
// applyRepairController: controller,
// isDel: false,
// ),
// ),
// );
// });
// return images;
// }
List<Widget> getImage(List<dynamic> imgurl) { List<Widget> getImage(List<dynamic> imgurl) {
List<Widget> images = [];
ApplyRepairController controller = Get.find(); ApplyRepairController controller = Get.find();
imgurl!.forEach((element) async { return imgurl.map<Widget>((element) {
images.add( return SizedBox(
Container( width: 90,
// height: 10, height: 90,
// width: 10, child: ImgPreviewWidget(
imgUrl: element,
child: ImgPreviewWidget( index: imgurl.indexOf(element),
imgUrl: element, applyRepairController: controller,
index: imgurl!.indexOf(element), isDel: false,
applyRepairController: controller,
isDel: false,
),
), ),
); );
}); }).toList();
return images;
} }
} }

View File

@@ -117,50 +117,107 @@ class DeviceRepairPage extends GetView<RepairListController> {
), ),
SizedBox(height: 33.rpx), SizedBox(height: 33.rpx),
// 可滚动的正文部分,限定高度 // 可滚动的正文部分,限定高度
// Expanded(
// child: SingleChildScrollView(
// child: RichText(
// text: TextSpan(
// style: TextStyle(
// color: Color(0XFF929699),
// fontSize: 26.rpx,
// ),
// children: [
// TextSpan(
// text:
// "尊敬的用户感谢您选择我司产品。在使用过程中如果设备出现故障需要维修请首先确认设备是否正确连接控制器或网络检查设置是否正常排除误操作问题。若问题依然存在请记录下设备名称、设备编号、和具体故障内容方便我们快速地为您提供帮助。您可以通过智慧棉花糖APP保修页面直接报修或拨打 "
// .tr,
// style: TextStyle(
// color: Color(0XFF929699),
// fontSize: 26.rpx,
// height: 1.3)),
// TextSpan(
// text: "400-8756-966",
// style: TextStyle(
// color: Colors.white,
// // height: 1.3,
// decoration: TextDecoration
// .underline, // 添加下划线
// decorationColor: Colors.white,
// decorationThickness: 4.rpx,
// ),
// recognizer: TapGestureRecognizer()
// ..onTap = () {
// MyUtils.makePhoneCall(
// "400-8756-966");
// },
// ),
// TextSpan(
// text: " 反馈。".tr,
// style: TextStyle(
// color: Color(0XFF929699),
// fontSize: 26.rpx,
// height: 1.3)),
// ],
// ),
// ),
// ),
// ),
Expanded( Expanded(
child: SingleChildScrollView( child: Padding(
child: RichText( padding: EdgeInsets.only(
text: TextSpan( right: 0,
style: TextStyle( ),
color: Color(0XFF929699), child: Scrollbar(
fontSize: 26.rpx, thumbVisibility:
), true, // 滚动时显示滑块false 时仅在滚动中短暂显示
children: [ thickness: 4.rpx,
TextSpan( child: SingleChildScrollView(
child: RichText(
text: TextSpan(
style: TextStyle(
color: Color(0XFF929699),
fontSize: 26.rpx,
),
children: [
TextSpan(
text: text:
"尊敬的用户感谢您选择我司产品。在使用过程中如果设备出现故障需要维修请首先确认设备是否正确连接控制器或网络检查设置是否正常排除误操作问题。若问题依然存在请记录下设备名称、设备编号、和具体故障内容方便我们快速地为您提供帮助。您可以通过智慧棉花糖APP保修页面直接报修或拨打 " "尊敬的用户感谢您选择我司产品。在使用过程中如果设备出现故障需要维修请首先确认设备是否正确连接控制器或网络检查设置是否正常排除误操作问题。若问题依然存在请记录下设备名称、设备编号、和具体故障内容方便我们快速地为您提供帮助。您可以通过智慧棉花糖APP保修页面直接报修或拨打 "
.tr, .tr,
style: TextStyle( style: TextStyle(
color: Color(0XFF929699), color: Color(0XFF929699),
fontSize: 26.rpx, fontSize: 26.rpx,
height: 1.3)), height: 1.3,
TextSpan( ),
text: "400-8756-966",
style: TextStyle(
color: Colors.white,
// height: 1.3,
decoration: TextDecoration
.underline, // 添加下划线
decorationColor: Colors.white,
decorationThickness: 4.rpx,
), ),
recognizer: TapGestureRecognizer() TextSpan(
..onTap = () { text: "400-8756-966",
MyUtils.makePhoneCall( style: TextStyle(
"400-8756-966"); color: Colors.white,
}, decoration:
), TextDecoration.underline,
TextSpan( decorationColor: Colors.white,
decorationThickness: 4.rpx,
),
recognizer:
TapGestureRecognizer()
..onTap = () {
MyUtils.makePhoneCall(
"400-8756-966");
},
),
TextSpan(
text: " 反馈。".tr, text: " 反馈。".tr,
style: TextStyle( style: TextStyle(
color: Color(0XFF929699), color: Color(0XFF929699),
fontSize: 26.rpx, fontSize: 26.rpx,
height: 1.3)), height: 1.3,
], ),
),
],
),
), ),
), ),
), ),
), ))
], ],
))), ))),
SizedBox(height: 24.rpx), SizedBox(height: 24.rpx),

View File

@@ -85,50 +85,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
left: 0.rpx, left: 0.rpx,
child: returnIconButtomNew(), child: returnIconButtomNew(),
), ),
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 10.rpx,
onTap: () async {
ApiResponse apiResponse =
await userInfoController.updateData();
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
if (apiResponse.code == HttpStatusCodes.ok) {
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
await userInfoController.getUserInfo();
userInfoController.updateAll();
Get.back();
}
},
colors: [
stringToColor("FCFCFC"),
stringToColor("CEECE3"),
],
gradientDirection: GradientDirection.vertical,
child: Container(
width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0.rpx, 16.rpx, 0.rpx),
child: Text(
'保存'.tr,
style: TextStyle(
fontFamily: 'Inter Tight',
color: stringToColor("#011D33"),
letterSpacing: 0.0,
fontSize: AppConstants().normal_text_fontSize),
),
),
),
),
], ],
), ),
), ),
@@ -143,174 +100,258 @@ class _UpdateUserPageState extends State<EditUserPage> {
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
60.rpx, 0.rpx, 60.rpx, 0.rpx), 30.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Container(
padding: EdgeInsetsDirectional.fromSTEB( child: Column(
0.rpx, 76.rpx, 0.rpx, 0.rpx), children: [
child: Container( Padding(
width: MediaQuery.sizeOf(context).width * 0.213, padding: EdgeInsetsDirectional.fromSTEB(
height: MediaQuery.sizeOf(context).height * 0.098, 0.rpx, 76.rpx, 0.rpx, 0.rpx),
constraints: BoxConstraints( child: Container(
minWidth: 160.rpx, width:
minHeight: 160.rpx, MediaQuery.sizeOf(context).width * 0.213,
height:
MediaQuery.sizeOf(context).height * 0.098,
constraints: BoxConstraints(
minWidth: 160.rpx,
minHeight: 160.rpx,
),
decoration: BoxDecoration(),
child: Obx(() {
return getImageWidget(context);
})),
), ),
decoration: BoxDecoration(), Padding(
child: Obx(() { padding: EdgeInsets.symmetric(
return getImageWidget(context); vertical: 38.rpx), // 保持上下间距
})), child: Center(
), child: ClickableContainer(
ClickableContainer( backgroundColor: Colors.transparent,
backgroundColor: Colors.transparent, highlightColor:
highlightColor: themeController.currentColor.sc2, themeController.currentColor.sc2,
padding: EdgeInsetsDirectional.fromSTEB( borderRadius: 8.rpx, // 可选,点击反馈更明显
0.rpx, 44.rpx, 0.rpx, 44.rpx), padding: EdgeInsets.symmetric(
borderRadius: 0, horizontal: 12.rpx,
onTap: () async { vertical: 12.rpx), // 控制点击热区大小
edm.EasyDartModule.logger onTap: () async {
.info("${userInfoController.model.user!}点击上传头像"); edm.EasyDartModule.logger.info(
DailyLogUtils.writeLog( "${userInfoController.model.user!}点击上传头像");
"${userInfoController.model.user!}点击上传头像"); DailyLogUtils.writeLog(
ApiResponse apiResponse = "${userInfoController.model.user!}点击上传头像");
await userInfoController.uploadImg(); ApiResponse apiResponse =
TopSlideNotification.show( await userInfoController.uploadImg();
context, TopSlideNotification.show(
text: apiResponse.msg!, context,
textColor: apiResponse.code == HttpStatusCodes.ok text: apiResponse.msg!,
? themeController.currentColor.sc2 textColor: apiResponse.code ==
: themeController.currentColor.sc9, HttpStatusCodes.ok
); ? themeController.currentColor.sc2
}, : themeController.currentColor.sc9,
child: Center( );
child: Text( },
'点击更换头像'.tr, child: Text(
style: TextStyle( '点击更换头像'.tr,
fontFamily: 'Inter', style: TextStyle(
fontSize: 26.rpx, fontFamily: 'Inter',
letterSpacing: 0.0, fontSize: 26.rpx,
color: stringToColor("#85F5FF"), letterSpacing: 0.0,
), color: stringToColor("#85F5FF"),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 79.rpx, 0.rpx, 0.rpx),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
bottom: BorderSide(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Container(
width: 100.rpx,
height: 100.rpx,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: TextFormField(
initialValue: userInfoController
.model.user!.nick_name,
onChanged: (value) {
userInfoController.model.user!
.tmpNickName = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '未命名'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: false,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
textAlign: TextAlign.center,
cursorColor: themeController
.currentColor.sc3,
),
),
),
), ),
].divide(SizedBox(width: 27.rpx)), ),
), ),
), ),
], ),
), Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 79.rpx, 30.rpx, 0.rpx),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
bottom: BorderSide(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Stack(
children: [
TextFormField(
initialValue: userInfoController
.model.user!.nick_name,
onChanged: (value) {
userInfoController.model.user!
.tmpNickName = value;
},
maxLength:
AppConstants().text_length,
maxLines: 1,
textAlign: TextAlign.center,
textAlignVertical:
TextAlignVertical.center,
buildCounter: (_,
{int? currentLength,
bool? isFocused,
int? maxLength}) =>
null, // 禁用默认计数器
decoration: InputDecoration(
contentPadding:
EdgeInsets.symmetric(
vertical: 30.rpx),
isDense: true,
hintText: '未命名'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
color: themeController
.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
Colors.transparent,
width: 1.rpx),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
Colors.transparent,
width: 1.rpx),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
width: 1.rpx),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: false,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
color: themeController
.currentColor.sc3,
),
cursorColor: themeController
.currentColor.sc3,
),
// 自定义右下角计数器
Positioned(
bottom: 4.rpx,
right: 8.rpx,
child: Obx(() {
final text =
userInfoController
.model
.user!
.tmpNickName ??
'';
return Text(
'${text.length} / ${AppConstants().text_length}',
style: TextStyle(
fontSize: 20.rpx,
color: Colors.grey,
),
);
}),
),
],
)),
].divide(SizedBox(width: 27.rpx)),
),
),
],
),
),
),
],
), ),
), ),
Padding(
padding: EdgeInsets.only(
left: 0.rpx, right: 0.rpx, bottom: 85.rpx),
child: CustomCard(
borderRadius: 10.rpx,
onTap: () async {
ApiResponse apiResponse =
await userInfoController.updateData();
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
if (apiResponse.code == HttpStatusCodes.ok) {
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
await userInfoController.getUserInfo();
userInfoController.updateAll();
Get.back();
}
},
colors: [
stringToColor("FCFCFC"),
stringToColor("CEECE3"),
],
gradientDirection: GradientDirection.vertical,
child: Container(
// width: 100.rpx,
height: 90.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0.rpx, 16.rpx, 0.rpx),
child: Text(
'保存'.tr,
style: TextStyle(
fontFamily: 'Inter Tight',
color: stringToColor("#011D33"),
letterSpacing: 0.0,
fontSize:
AppConstants().normal_text_fontSize),
),
),
),
)
], ],
), ),
), ),

View File

@@ -78,13 +78,20 @@ class _AIAdviceWidgetState extends State<AIAdviceWidget> {
Container( Container(
child: Text( child: Text(
// "AI分析介绍".tr, // "AI分析介绍".tr,
"AI分析是指利用人工智能技术对用户的睡眠数据进行自动化处理与规律提取对用户的异常睡眠数据给到一定的辅助决策或者解决问题。".tr, "AI分析是指利用人工智能技术对用户的睡眠数据进行自动化处理与规律提取对用户的异常睡眠数据给到一定的辅助决策或者解决问题。"
.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -101,10 +101,16 @@ class _SnoreViewWidgetWidgetState extends State<BreathePauseNewWidget> {
"呼吸暂停监测是指用户在睡眠过程中产生的呼吸暂停的图表说明。", "呼吸暂停监测是指用户在睡眠过程中产生的呼吸暂停的图表说明。",
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -144,10 +144,16 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
.tr, .tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -36,172 +36,180 @@ class _CompareSleepWidgetState extends State<CompareSleepWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
try { try {
if (widget.sleepReport == null || if (widget.sleepReport == null ||
widget.sleepReport['yc'] == null || widget.sleepReport['yc'] == null ||
widget.sleepReport['yc'].isEmpty) { widget.sleepReport['yc'].isEmpty) {
return Container(); return Container();
} }
List<Map<String, dynamic>> data = (widget.sleepReport['yc'] as List) List<Map<String, dynamic>> data = (widget.sleepReport['yc'] as List)
.map((e) => e as Map<String, dynamic>) .map((e) => e as Map<String, dynamic>)
.toList(); .toList();
Map<String, double> today = {}; Map<String, double> today = {};
Map<String, double> yesterday = {}; Map<String, double> yesterday = {};
for (var item in data) { for (var item in data) {
String typeKey = 'type${item['id']}'; String typeKey = 'type${item['id']}';
today[typeKey] = (item['t'] as num).toDouble(); today[typeKey] = (item['t'] as num).toDouble();
yesterday[typeKey] = (item['y'] as num).toDouble(); yesterday[typeKey] = (item['y'] as num).toDouble();
} }
return Container( return Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: themeController.currentColor.sc5, color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius), // 你可以按需调整圆角半径 AppConstants().normal_container_radius), // 你可以按需调整圆角半径
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx), padding:
child: Column( EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
mainAxisSize: MainAxisSize.max, child: Column(
children: [ mainAxisSize: MainAxisSize.max,
Container( children: [
child: Row( Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Row(
children: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Text( children: [
"与昨日对比分析".tr, Text(
style: TextStyle( "与昨日对比分析".tr,
color: themeController.currentColor.sc3, style: TextStyle(
fontSize: AppConstants().title_text_fontSize), color: themeController.currentColor.sc3,
), fontSize: AppConstants().title_text_fontSize),
ClickableContainer( ),
backgroundColor: Colors.transparent, ClickableContainer(
highlightColor: Colors.white, // 或设置为你需要的水波纹颜色 backgroundColor: Colors.transparent,
padding: EdgeInsetsDirectional.fromSTEB( highlightColor: Colors.white, // 或设置为你需要的水波纹颜色
14.rpx, 0.rpx, 14.rpx, 0), // padding: EdgeInsetsDirectional.fromSTEB(
borderRadius: 0.rpx, // 圆形点击区域 14.rpx, 0.rpx, 14.rpx, 0), //
onTap: () { borderRadius: 0.rpx, // 圆形点击区域
showTipDialog( onTap: () {
context, showTipDialog(
Container( context,
child: Text( Container(
// "与昨日对比分析介绍".tr, child: Text(
"基于时间维度的横向比较分析方法,通过将当前(今日)的数据、状态、行为等与前一日(昨日)的同类信息进行对照,识别差异、趋势或变化规律,查看用户短期时间序列的动态变化。".tr, // "与昨日对比分析介绍".tr,
style: TextStyle( "基于时间维度的横向比较分析方法,通过将当前(今日)的数据、状态、行为等与前一日(昨日)的同类信息进行对照,识别差异、趋势或变化规律,查看用户短期时间序列的动态变化。"
fontSize: 26.rpx, .tr,
color: themeController.currentColor.sc3, style: TextStyle(
fontSize: 26.rpx,
color: Colors.black,
),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
);
},
child: Container(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部
width: 28.rpx,
height: 28.rpx,
child: SvgPicture.asset(
'assets/img/icon/explain.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
), ),
); ),
}, ),
child: Container( ],
),
),
SizedBox(
height: 31.rpx,
),
// Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
// child: SleepRadarChart(
// today: today,
// yesterday: yesterday,
// ),
// ),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Stack(
children: [
// 雷达图
Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部 30.rpx, 0.rpx, 0.rpx, 0.rpx),
width: 28.rpx, child: SleepRadarChart(
height: 28.rpx, // today: today,
child: SvgPicture.asset( // yesterday: yesterday,
'assets/img/icon/explain.svg', data: data,
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
), ),
), ),
), // 在左侧添加一个 Text
], Positioned(
), left: 0, // 这里可以修改文本左边的距离
), top: 0, // 这里可以修改文本顶部的距离
SizedBox( child: Container(
height: 31.rpx, color: Colors.transparent, // 不需要背景色,可以去掉
), child: Column(
// Padding( crossAxisAlignment: CrossAxisAlignment.start,
// padding: children: [
// EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0.rpx), Row(
// child: SleepRadarChart( children: [
// today: today, // 长条容器
// yesterday: yesterday, Container(
// ), width:
// ), 34.rpx, // 你可以设置容器的宽度,或者使用 Expanded 填充剩余空间
Padding( height: 2.rpx, // 容器的高度
padding: color: stringToColor("#00C1AA"), // 容器的颜色
EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Stack(
children: [
// 雷达图
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 0.rpx, 0.rpx),
child: SleepRadarChart(
// today: today,
// yesterday: yesterday,
data: data,
),
),
// 在左侧添加一个 Text
Positioned(
left: 0, // 这里可以修改文本左边的距离
top: 0, // 这里可以修改文本顶部的距离
child: Container(
color: Colors.transparent, // 不需要背景色,可以去掉
child: Column(
children: [
Row(
children: [
// 长条容器
Container(
width:
34.rpx, // 你可以设置容器的宽度,或者使用 Expanded 填充剩余空间
height: 2.rpx, // 容器的高度
color: stringToColor("#00C1AA"), // 容器的颜色
),
SizedBox(width: 13.rpx), // 文字和容器之间的间距
// 文字
Text(
'今日数据'.tr, // 文字内容
style: TextStyle(
fontSize: 18.rpx, // 文字大小
color:
themeController.currentColor.sc4, // 文字颜色
), ),
), SizedBox(width: 13.rpx), // 文字和容器之间的间距
], // 文字
), Text(
Row( '今日数据'.tr, // 文字内容
children: [ style: TextStyle(
// 长条容器 fontSize: 18.rpx, // 文字大小
Container( color: themeController
width: .currentColor.sc4, // 文字颜色
34.rpx, // 你可以设置容器的宽度,或者使用 Expanded 填充剩余空间 ),
height: 2.rpx, // 容器的高度
color: stringToColor("#FFD251"), // 容器的颜色
),
SizedBox(width: 13.rpx), // 文字和容器之间的间距
// 文字
Text(
'昨日数据'.tr, // 文字内容
style: TextStyle(
fontSize: 18.rpx, // 文字大小
color:
themeController.currentColor.sc4, // 文字颜色
), ),
), ],
], ),
), Row(
].divide(SizedBox(height: 25.rpx)), children: [
// 长条容器
Container(
width:
34.rpx, // 你可以设置容器的宽度,或者使用 Expanded 填充剩余空间
height: 2.rpx, // 容器的高度
color: stringToColor("#FFD251"), // 容器的颜色
),
SizedBox(width: 13.rpx), // 文字和容器之间的间距
// 文字
Text(
'昨日数据'.tr, // 文字内容
style: TextStyle(
fontSize: 18.rpx, // 文字大小
color: themeController
.currentColor.sc4, // 文字颜色
),
),
],
),
].divide(SizedBox(height: 25.rpx)),
),
), ),
), ),
), ],
], ),
), ),
), ],
], ),
), ),
), );
); } catch (e) {
} catch (e) {
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}"); es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
return Container(); return Container();
} }
} }
} }

View File

@@ -18,7 +18,6 @@ class DiseasePercentsWidget extends StatefulWidget {
} }
class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> { class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> {
@override @override
void setState(VoidCallback callback) { void setState(VoidCallback callback) {
super.setState(callback); super.setState(callback);
@@ -37,89 +36,96 @@ class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
try { try {
if (widget.sleepReport == null || if (widget.sleepReport == null ||
widget.sleepReport['cdri'] == null || widget.sleepReport['cdri'] == null ||
widget.sleepReport['cdri'].isEmpty) { widget.sleepReport['cdri'].isEmpty) {
return Container(); return Container();
} }
List diseaseData = widget.sleepReport['cdri']; List diseaseData = widget.sleepReport['cdri'];
var showLabel = convertDiseaseData(diseaseData); var showLabel = convertDiseaseData(diseaseData);
return Container( return Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: themeController.currentColor.sc5, color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius), // 你可以按需调整圆角半径 AppConstants().normal_container_radius), // 你可以按需调整圆角半径
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx), padding:
child: Column( EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
mainAxisSize: MainAxisSize.max, child: Column(
children: [ mainAxisSize: MainAxisSize.max,
Container( children: [
child: Row( Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Row(
children: [ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Text( children: [
"慢性病风险指数".tr, Text(
style: TextStyle( "慢性病风险指数".tr,
color: themeController.currentColor.sc3, style: TextStyle(
fontSize: AppConstants().title_text_fontSize), color: themeController.currentColor.sc3,
), fontSize: AppConstants().title_text_fontSize),
ClickableContainer( ),
backgroundColor: Colors.transparent, ClickableContainer(
highlightColor: Colors.white, // 或设置为你需要的水波纹颜色 backgroundColor: Colors.transparent,
padding: EdgeInsetsDirectional.fromSTEB( highlightColor: Colors.white, // 或设置为你需要的水波纹颜色
14.rpx, 0.rpx, 14.rpx, 0), // padding: EdgeInsetsDirectional.fromSTEB(
borderRadius: 0.rpx, // 圆形点击区域 14.rpx, 0.rpx, 14.rpx, 0), //
onTap: () { borderRadius: 0.rpx, // 圆形点击区域
// 你的点击逻辑 onTap: () {
showTipDialog( // 你的点击逻辑
context, showTipDialog(
Container( context,
child: Text( Container(
// "慢性病风险指数介绍".tr, child: Text(
"慢性病风险指数是通过整合个体的生理指标、生活方式等多维度数据,构建的量化评估模型,用于预测用户未来患慢性非传染性疾病(如高血压、糖尿病、冠心病、癌症等)的风险概率。".tr, // "慢性病风险指数介绍".tr,
style: TextStyle( "慢性病风险指数是通过整合个体的生理指标、生活方式等多维度数据,构建的量化评估模型,用于预测用户未来患慢性非传染性疾病(如高血压、糖尿病、冠心病、癌症等)的风险概率。"
fontSize: 26.rpx, .tr,
color: themeController.currentColor.sc3, style: TextStyle(
fontSize: 26.rpx,
color: Colors.black,
),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
);
},
child: Container(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部
width: 28.rpx,
height: 28.rpx,
child: SvgPicture.asset(
'assets/img/icon/explain.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
), ),
);
},
child: Container(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部
width: 28.rpx,
height: 28.rpx,
child: SvgPicture.asset(
'assets/img/icon/explain.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
), ),
), ),
), ],
], ),
), ),
), SizedBox(
SizedBox( height: 34.rpx,
height: 34.rpx,
),
Container(
child: HorizontalBarChart(
showLabel: showLabel,
showPercent: true,
), ),
), Container(
], child: HorizontalBarChart(
showLabel: showLabel,
showPercent: true,
),
),
],
),
), ),
), );
);
} catch (e) { } catch (e) {
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}"); es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
return Container(); return Container();
} }
} }

View File

@@ -83,10 +83,16 @@ class _HeartChangeWidgetState extends State<HeartChangeWidget> {
"心率变异性HRV是指心脏每次跳动间隔时间的差异程度反映自主神经系统交感神经和副交感神经对心脏的调节能力是评估心血管健康和压力状态的重要指标。".tr, "心率变异性HRV是指心脏每次跳动间隔时间的差异程度反映自主神经系统交感神经和副交感神经对心脏的调节能力是评估心血管健康和压力状态的重要指标。".tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -83,10 +83,16 @@ class _HeartHealthWidgetState extends State<HeartHealthWidget> {
"心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息来判断其心理健康水平、疲劳程度。".tr, "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息来判断其心理健康水平、疲劳程度。".tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -97,13 +97,20 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
Container( Container(
child: Text( child: Text(
// "心率散点图介绍".tr, // "心率散点图介绍".tr,
"心电散点图是用非线性的图形方法描记的连续心冲击图的RR间期图因图形由散点组成又称散点图。".tr, "心电散点图是用非线性的图形方法描记的连续心冲击图的RR间期图因图形由散点组成又称散点图。"
.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(
@@ -151,7 +158,7 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
), ),
); );
} catch (e) { } catch (e) {
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}"); es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
return Container(); return Container();
} }
} }

View File

@@ -144,10 +144,16 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
.tr, .tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -100,10 +100,16 @@ class _SkinPercentWidgetState extends State<SkinPercentWidget> {
.tr, .tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -98,13 +98,20 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
context, context,
Container( Container(
child: Text( child: Text(
"睡眠规律性是指个体睡眠模式在时间、时长、环境等方面呈现出的稳定性和一致性,是衡量睡眠质量的重要指标之一。".tr, "睡眠规律性是指个体睡眠模式在时间、时长、环境等方面呈现出的稳定性和一致性,是衡量睡眠质量的重要指标之一。"
.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -131,10 +131,16 @@ class _SnoreViewWidgetWidgetState extends State<SnoreViewWidgetWidget> {
"打鼾监测是指用户在睡眠过程中打鼾频次的图表说明。", "打鼾监测是指用户在睡眠过程中打鼾频次的图表说明。",
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -108,11 +108,22 @@ class AvgSleepScoreWidget extends StatelessWidget {
centerWidget: Column( centerWidget: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( // Text(
mediumLabel.tr, // mediumLabel.tr,
style: TextStyle( // style: TextStyle(
color: Colors.white, // color: Colors.white,
fontSize: AppConstants().normal_text_fontSize, // fontSize: AppConstants().normal_text_fontSize,
// ),
// ),
Padding(
padding:
EdgeInsets.only(top: 12.rpx), // 👈 向下偏移的关键
child: Text(
mediumLabel.tr,
style: TextStyle(
color: Colors.white,
fontSize: AppConstants().normal_text_fontSize,
),
), ),
), ),
Text( Text(

View File

@@ -102,10 +102,16 @@ class _ZiZhuShenJingPercentWidgetState
"自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。".tr, "自主神经平衡指数 是评估人体自主神经系统ANS功能状态的重要指标主要反映交感神经和副交感神经的活性平衡关系。".tr,
style: TextStyle( style: TextStyle(
fontSize: 26.rpx, fontSize: 26.rpx,
color: themeController.currentColor.sc3, color: Colors.black,
), ),
), ),
), ),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
); );
}, },
child: Container( child: Container(

View File

@@ -52,56 +52,57 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
@override @override
void initState() { void initState() {
if (Get.isRegistered<SleepReportController>(tag: widget.data["tag"]) == super.initState();
false) {
if (!Get.isRegistered<SleepReportController>(tag: widget.data["tag"])) {
Get.put(tag: widget.data["tag"], SleepReportController()); Get.put(tag: widget.data["tag"], SleepReportController());
} }
sleepReportController = Get.find(tag: widget.data["tag"]); sleepReportController = Get.find(tag: widget.data["tag"]);
sleepReportController.sleepReport.value = {}; sleepReportController.sleepReport.value = {};
if (widget.data['date'] == null) { if (widget.data['date'] == null) {
widget.data['date'] = DateTime.now(); widget.data['date'] = DateTime.now().millisecondsSinceEpoch;
} }
calendarController.selectedDate.value =
DateTime.fromMillisecondsSinceEpoch(widget.data['date']); // ✅ 延迟执行赋值逻辑
sleepReportController.selectedDate.value = WidgetsBinding.instance.addPostFrameCallback((_) {
DateTime.fromMillisecondsSinceEpoch(widget.data['date']); final selected = DateTime.fromMillisecondsSinceEpoch(widget.data['date']);
if (widget.data['type'] != null) {
sleepReportController.model.type = widget.data['type']; calendarController.selectedDate.value = selected;
} else { sleepReportController.selectedDate.value = selected;
sleepReportController.model.type = 1;
} if (widget.data['type'] != null) {
String date = MyUtils.formatToDate(widget.data['date']); sleepReportController.model.type = widget.data['type'];
// String date = '2025-5-27'; } else {
requestWithLog( sleepReportController.model.type = 1;
}
String date = MyUtils.formatToDate(widget.data['date']);
requestWithLog(
logTitle: "查询睡眠报告", logTitle: "查询睡眠报告",
method: MyHttpMethod.get, method: MyHttpMethod.get,
queryUrl: queryUrl:
"https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.data['mac']}&time=${date}&type=${sleepReportController.model.type}", "https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.data['mac']}&time=$date&type=${sleepReportController.model.type}",
onSuccess: (res) { onSuccess: (res) {
print(res);
sleepReportController.sleepReport.value = res.data; sleepReportController.sleepReport.value = res.data;
sleepReportController.updateAll(); sleepReportController.updateAll();
_scrollToTargetComponent(sleepReportController.sleepReport); _scrollToTargetComponent(sleepReportController.sleepReport);
}, },
onFailure: (res) { onFailure: (res) {
try { try {
if (MainPageBBottomChange.getCurrentIndex() != null) { if (MainPageBBottomChange.getCurrentIndex() == 1) {
if (MainPageBBottomChange.getCurrentIndex() == 1) { TopSlideNotification.show(context,
TopSlideNotification.show(context, text: res.msg!, textColor: themeController.currentColor.sc9);
text: res.msg!,
textColor: themeController.currentColor.sc9);
}
} else { } else {
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: res.msg!, textColor: themeController.currentColor.sc9); text: res.msg!, textColor: themeController.currentColor.sc9);
} }
} catch (e) { } catch (_) {}
e;
}
sleepReportController.sleepReport.value = {}; sleepReportController.sleepReport.value = {};
sleepReportController.updateAll(); sleepReportController.updateAll();
print(res); },
}); );
});
} }
@override @override

View File

@@ -453,7 +453,7 @@ packages:
description: description:
path: "." path: "."
ref: main ref: main
resolved-ref: e78402ccfdadfa7700d297a929dcb7e32347d2b5 resolved-ref: "9c4390c05d87832531a94aa8d02059a1e26eb354"
url: "https://gitea.wslpc.real.he-info.cn:94/flutter/easyweb.git" url: "https://gitea.wslpc.real.he-info.cn:94/flutter/easyweb.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@@ -470,7 +470,7 @@ packages:
description: description:
path: "." path: "."
ref: main ref: main
resolved-ref: "6f4f561aec070bc0912e6138ea91835e6348a11a" resolved-ref: "6b0a08903ae91ae57deaa783b2649858867d5eba"
url: "https://gitea.wslpc.real.he-info.cn:94/flutter/ef.git" url: "https://gitea.wslpc.real.he-info.cn:94/flutter/ef.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@@ -795,10 +795,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: fluwx name: fluwx
sha256: "9db31d54043363c9c8283b5f0bc4df982edb45ba19d800df9d7de96a205371ae" sha256: "46c78b678e2586ad21883dd1b1875b2f4548cf6bf52a388c839fe5d2a6a37e02"
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.7.0" version: "5.7.1"
font_awesome_flutter: font_awesome_flutter:
dependency: transitive dependency: transitive
description: description: