多语言后端数据

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

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

View File

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

View File

@@ -1,5 +1,6 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import '../../common/color/appFontsize.dart';
import '../../controller/mh_controller/apply_repair_controller.dart';
@@ -21,31 +22,20 @@ class ImgPreviewWidget extends GetView {
width: MediaQuery.sizeOf(context).width * 0.25,
height: MediaQuery.sizeOf(context).height * 0.15,
constraints: BoxConstraints(
minHeight: 140,
),
// minHeight: 140,
),
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.116,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.network(
imgUrl,
// applyRepairController.getPublicUrl(imgUrl),
width: 300,
height: 200,
fit: BoxFit.cover,
),
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: AspectRatio(
aspectRatio: 1, // 保证宽高比1:1
child: Image.network(
imgUrl,
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';
class TopSlideNotification extends StatefulWidget {
BuildContext?context;
final String text;
double? fontSize = 26.rpx;
Color? textColor;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -20,7 +20,7 @@ class MhMessageModel {
int? type = 1; //设备类型 1:体征消息 2.系统消息
int? body_message_read = 0; //体征消息 0已读 1未读
int? system_message_read = 0; //系统消息 0已读 1未读
MhMessageModel();
// 从JSON反序列化时的异常处理
@@ -61,8 +61,8 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${messageType}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) {
@@ -114,8 +114,8 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) {
@@ -180,8 +180,8 @@ class MhMessageController extends GetControllerEx<MhMessageModel> {
}
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
if (language != null && language.isNotEmpty) {
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/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/model/api_response.dart';
part 'mhdevice_share_controller.g.dart';
@@ -74,8 +75,14 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
String serviceApi = ServiceConstant.device_share;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
if (AppConstants().ent_type == APPPackageType.MHT.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 (queryUrl.contains("?")) {
@@ -152,8 +159,14 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
String serviceApi = ServiceConstant.device_share;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
if (AppConstants().ent_type == APPPackageType.MHT.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 (queryUrl.contains("?")) {

View File

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

View File

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

View File

@@ -14,11 +14,14 @@ import 'package:get_storage/get_storage.dart';
import 'package:localstorage/localstorage.dart';
import 'package:syncfusion_localizations/syncfusion_localizations.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/CommonVariables.dart';
import 'package:vbvs_app/common/util/Dio.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.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/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/time/countdown_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/model/CustomThemeColor.dart';
import 'package:vbvs_app/model/api_response.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/device/component/mht_device_calibration_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}');
// final selectapp = "th";
final selectapp = "mht";
// final selectapp = "mht";
// await AppLanguage().loadLanguage("en_US");
await loadLanguageSetting(selectapp);
await loadLanguageSetting();
await initLanguageSetting();
WidgetsFlutterBinding.ensureInitialized();
@@ -102,7 +107,7 @@ Future<void> main() async {
await messageStatus();
startMessagePolling(selectapp);
startMessagePolling(AppConstants().ent_type);
// 检查网络
Checknetwork.checkNetwork();
// 微信开放平台注册
@@ -119,12 +124,12 @@ Future<void> main() async {
});
}
loadLanguageSetting(String selectapp) async {
loadLanguageSetting() async {
await ef.kvdb.openDir("mht");
String? language = await ef.kvdb.read("mht/language");
language ??= 'zh_CN';
await AppLanguage().loadLanguage(language, project: selectapp);
await AppLanguage().loadLanguage(language, project: APPPackageType.MHT.code);
}
void initwebService() {
@@ -136,11 +141,15 @@ void initwebService() {
});
}
initLanguageSetting() {
initLanguageSetting() async {
try {
Get.put(MHLanguageController());
MHLanguageController mhLanguageController = Get.find();
await mhLanguageController.initLanuageList();
Get.put(LanguageController());
LanguageController languageController = Get.find();
languageController.initLanuageList();
await languageController.initLanuageList();
} catch (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();
if (selectapp == 'mht') {
if (ent_type == APPPackageType.MHT.code) {
if (Get.isRegistered<MhMessageController>()) {
Get.find<MhMessageController>().getMessageStatus();
}
@@ -188,7 +199,7 @@ void startMessagePolling(String selectapp) {
}
_messageTimer = Timer.periodic(Duration(seconds: 10), (timer) async {
try {
if (selectapp == 'mht') {
if (ent_type == APPPackageType.MHT.code) {
if (Get.isRegistered<MhMessageController>()) {
Get.find<MhMessageController>().getMessageStatus();
}
@@ -393,10 +404,10 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => SleepingHabitController()),
Get.lazyPut(() => PeopleInfoController()),
Get.lazyPut(() => MainPageController()),
Get.lazyPut(() => MHLanguageController()),
Get.lazyPut(() => MhMessageController()),
Get.lazyPut(() => AddressListController()),
Get.lazyPut(() => AddressController()),
Get.lazyPut(() => MHLanguageController()),
// Get.lazyPut(() => MHLanguageController()),
Get.lazyPut(() => BlueteethBindController()),
Get.lazyPut(() => BookInfoController()),
Get.lazyPut(() => PersonController()),

View File

@@ -1288,11 +1288,11 @@ Future<void> showDeleteDeviceConfirmDialog({
style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
children: [
TextSpan(
text: '删除后,',
text: '删除后,'.tr,
style:
TextStyle(color: Colors.red, fontSize: 26.rpx)),
TextSpan(
text: '该设备的历史数据将被清除',
text: '该设备的历史数据将被清除'.tr,
style: TextStyle(fontSize: 26.rpx),
),
],
@@ -1319,7 +1319,7 @@ Future<void> showDeleteDeviceConfirmDialog({
height: 90.rpx,
alignment: Alignment.center,
child: Text(
'取消',
'取消'.tr,
style: TextStyle(
fontSize: 26.rpx, color: Colors.white),
),
@@ -1340,7 +1340,7 @@ Future<void> showDeleteDeviceConfirmDialog({
height: 90.rpx,
alignment: Alignment.center,
child: Text(
'删除',
'删除'.tr,
style: TextStyle(
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; // 记录上一次返回的时间
@override
Widget build(BuildContext context) {
return Obx(() {
final currentLanguage =
languageController.selectLanguage.value; // 监听此变量变化

View File

@@ -82,42 +82,7 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
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(
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/CustomCard.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/pages/device_bind/componnet/FancyCircleCheckbox.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()
.loadLanguage(
language.language_code,
project: "mht"); // 加载语言
project: AppConstants()
.ent_type); // 加载语言
languageController
.updateAll(); // 更新操作
languageController
@@ -179,41 +181,43 @@ class _LanguagePageState extends State<LanguagePage> {
false, // 根据 selected 状态显示选中或未选中
onChanged: (value) async {
// // 保持原有的状态更改逻辑
// for (var lang
// in languageController
// .languageList) {
// lang.selected = (lang ==
// language); // 更新选中状态
// }
// 点击事件逻辑
for (var lang
in languageController
.languageList) {
lang.selected = (lang ==
language); // 根据选择更新状态
}
// await AppLanguage()
// .loadLanguage(
// language
// .language_code,
// project:
// "mht"); // 加载语言
// languageController
// .updateAll(); // 更新操作
// languageController
// .selectLanguage
// .value = language;
// final list =
// deviceController
// .personnelList
// .value;
// deviceController
// .getHomeSleeps(
// list[0]["mac"],
// context);
// final box = GetStorage();
// try {
// box.write(
// 'language',
// language
// .language_code);
// } catch (e) {
// print(e);
// }
await AppLanguage().loadLanguage(
language
.language_code,
project: AppConstants()
.ent_type); // 加载语言
languageController
.updateAll(); // 更新操作
languageController
.selectLanguage
.value = language;
final list =
deviceController
.personnelList
.value;
deviceController
.getHomeSleeps(
list[0]["mac"],
context);
try {
// ef.kv.set("language",
// language.language_code);
ef.kvdb.write(
"mht/language",
language
.language_code);
} catch (e) {
print(e);
}
},
),
].divide(SizedBox(

View File

@@ -143,6 +143,8 @@ class ShareDeviceDetailWidget extends GetView {
} catch (e) {
ef.log("[h5]通知列表更新错误:$e");
}
isProgrammaticPop = true; // 设置为程序触发,避免再次触发 PopScope
Get.back(); // 或 Navigator.pop(context);
},
onFailure: (res) {
TopSlideNotification.show(context,
@@ -152,12 +154,12 @@ class ShareDeviceDetailWidget extends GetView {
} catch (e) {
print(e);
}
if (Platform.isAndroid) {
var flag = await _handleBackPressed(context); // 自定义返回逻辑
if (flag) {
SystemNavigator.pop();
}
}
// if (Platform.isAndroid) {
// var flag = await _handleBackPressed(context); // 自定义返回逻辑
// if (flag) {
// SystemNavigator.pop();
// }
// }
},
child: Container(
width: MediaQuery.sizeOf(context).width,
@@ -423,7 +425,9 @@ class ShareDeviceDetailWidget extends GetView {
gradientDirection: GradientDirection.vertical,
onTap: () async {
deviceListController.unbindShareDevice(
data['info'][5]['uid'], data['mac'.tr], context);
data['info'][5]['uid'],
data['mac'.tr],
context);
},
colors: const [
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: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints(
minHeight: 220.rpx,
),
decoration: BoxDecoration(
color: Color(0xFF003058),
borderRadius: BorderRadius.circular(16),
),
child: Slidable(
endActionPane: ActionPane(
extentRatio: 0.26,
motion: ScrollMotion(),
children: [
Expanded(
child: InkWell(
onTap: () async {
await addressListController.deleteAddress(
addressListController.model.addressList[index]
['_id']);
addressListController.model.addressList.removeAt(index);
child: Slidable(
key:
ValueKey(addressListController.model.addressList[index]['_id']),
endActionPane: ActionPane(
extentRatio: 0.26,
motion: ScrollMotion(),
children: [
Expanded(
child: InkWell(
onTap: () async {
await addressListController.deleteAddress(
addressListController.model.addressList[index]
['_id']);
addressListController.model.addressList.removeAt(index);
addressListController.updateAll();
},
child: Container(
margin: EdgeInsets.only(left: 30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.red,
),
alignment: Alignment.center,
child: Icon(
Icons.delete,
color: Colors.white,
),
addressListController.updateAll();
},
child: Container(
margin: EdgeInsets.only(left: 30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.red,
),
alignment: Alignment.center,
child: Icon(
Icons.delete,
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(
padding: EdgeInsetsDirectional.fromSTEB(

View File

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

View File

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

View File

@@ -37,6 +37,11 @@ class _EditBedPageState extends State<EditBedPage> {
super.initState();
editedData = Map.from(widget.data); // 创建副本
_nameController = TextEditingController(text: editedData['name']);
// 添加监听器
_nameController.addListener(() {
setState(() {}); // 每次文字变化刷新UI
});
}
@override
@@ -181,84 +186,178 @@ class _EditBedPageState extends State<EditBedPage> {
height: 193.rpx,
),
Padding(
padding:
EdgeInsets.symmetric(horizontal: 60.rpx),
child: 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,
padding:
EdgeInsets.symmetric(horizontal: 60.rpx),
child: Container(
alignment: Alignment.center,
height: bodysize!.maxHeight * 0.076,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color(0xFF929699), // 灰色底部线
width: 0.5, // 根据需要设置宽度
),
),
))
),
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(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 4),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -31,43 +31,6 @@ class _MinePageState extends State<NewMinePage> {
UserInfoController userInfoController = Get.find();
ThemeController themeController = 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
Widget build(BuildContext context) {
@@ -100,29 +63,35 @@ class _MinePageState extends State<NewMinePage> {
return ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.only(right: 38.rpx),
padding: EdgeInsets.only(right: 20.rpx),
onTap: () {
Get.toNamed('/messagePage');
},
child: Stack(
clipBehavior: Clip.none,
children: [
// 扩大点击区域但不影响SVG图标尺寸
Container(
height: 42.rpx,
width: 42.rpx,
child: SvgPicture.asset(
'assets/img/icon/message.svg',
color: Colors.white,
width: 60.rpx, // 比图标大
height: 60.rpx,
alignment: Alignment.center,
child: Container(
width: 42.rpx,
height: 42.rpx,
child: SvgPicture.asset(
'assets/img/icon/message.svg',
color: Colors.white,
),
),
),
if (messageController.model.body_message_read == 1 ||
messageController.model.system_message_read == 1)
Positioned(
top: 4.rpx,
right: -10.rpx,
top: 8.rpx,
right: -1.rpx,
child: Container(
width: 12.rpx,
height: 12.rpx,
width: 14.rpx,
height: 14.rpx,
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
@@ -143,11 +112,12 @@ class _MinePageState extends State<NewMinePage> {
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsets.only(
top: 30.rpx, left: 60.rpx, bottom: 190.rpx),
child: Row(
children: [
Container(
padding: EdgeInsets.only(
top: 30.rpx, left: 60.rpx, bottom: 190.rpx),
child: Row(
children: [
Obx(() {
return Container(
width: 120.rpx,
height: 120.rpx,
clipBehavior: Clip.antiAlias,
@@ -172,111 +142,110 @@ class _MinePageState extends State<NewMinePage> {
"assets/images/mine_avatar.png",
fit: BoxFit.cover,
),
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
login == 1
? (userInfoController
.model.user!.nick_name ??
'未命名'.tr)
: "未命名".tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController.currentColor.sc3,
fontSize:
AppConstants().title_text_fontSize,
letterSpacing: 0.0,
),
);
}),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
login == 1
? (userInfoController
.model.user!.nick_name ??
'未命名'.tr)
: "未命名".tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController.currentColor.sc3,
fontSize:
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(
child: Container(
@@ -304,15 +273,15 @@ class _MinePageState extends State<NewMinePage> {
'当您的智能设备需要报修时,可以通过该功能联系解决,'.tr,
path: '/deviceRepairPage',
),
_buildListTile('assets/img/icon/mall.svg', '网上商城'.tr,
'最新的智能产品线上购买服务'.tr,
path: "", onTap: () {
_buildListTile('assets/img/icon/mall.svg',
'网上商城'.tr, '最新的智能产品线上购买服务'.tr, path: "",
onTap: () {
JDLauncher.openShop(
"https://mall.jd.com/index-14587480.html");
}),
_buildListTile('assets/img/icon/address.svg',
'地址管理'.tr, '用于收货和报修时联系您'.tr,
path: "/addressListPage"),
// _buildListTile('assets/img/icon/address.svg',
// '地址管理'.tr, '用于收货和报修时联系您'.tr,
// path: "/addressListPage"),
_buildListTile('assets/img/icon/help.svg',
'问题与帮助'.tr, '常见的问题汇总,如:智能床连接流程、如何查看睡眠报告'.tr,
path: "/issueListpage"),
@@ -474,8 +443,8 @@ class _MinePageState extends State<NewMinePage> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.rpx)),
),
child:
Text('设置'.tr, style: TextStyle(fontSize: 26.rpx, color: Colors.white)),
child: Text('设置'.tr,
style: TextStyle(fontSize: 26.rpx, color: Colors.white)),
),
);
}

View File

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

View File

@@ -117,50 +117,107 @@ class DeviceRepairPage extends GetView<RepairListController> {
),
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(
child: SingleChildScrollView(
child: RichText(
text: TextSpan(
style: TextStyle(
color: Color(0XFF929699),
fontSize: 26.rpx,
),
children: [
TextSpan(
child: Padding(
padding: EdgeInsets.only(
right: 0,
),
child: Scrollbar(
thumbVisibility:
true, // 滚动时显示滑块false 时仅在滚动中短暂显示
thickness: 4.rpx,
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,
color: Color(0XFF929699),
fontSize: 26.rpx,
height: 1.3,
),
),
recognizer: TapGestureRecognizer()
..onTap = () {
MyUtils.makePhoneCall(
"400-8756-966");
},
),
TextSpan(
TextSpan(
text: "400-8756-966",
style: TextStyle(
color: Colors.white,
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)),
],
color: Color(0XFF929699),
fontSize: 26.rpx,
height: 1.3,
),
),
],
),
),
),
),
),
))
],
))),
SizedBox(height: 24.rpx),

View File

@@ -85,50 +85,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
left: 0.rpx,
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(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
60.rpx, 0.rpx, 60.rpx, 0.rpx),
30.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 76.rpx, 0.rpx, 0.rpx),
child: Container(
width: MediaQuery.sizeOf(context).width * 0.213,
height: MediaQuery.sizeOf(context).height * 0.098,
constraints: BoxConstraints(
minWidth: 160.rpx,
minHeight: 160.rpx,
Container(
child: Column(
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 76.rpx, 0.rpx, 0.rpx),
child: Container(
width:
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(),
child: Obx(() {
return getImageWidget(context);
})),
),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc2,
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 44.rpx, 0.rpx, 44.rpx),
borderRadius: 0,
onTap: () async {
edm.EasyDartModule.logger
.info("${userInfoController.model.user!}点击上传头像");
DailyLogUtils.writeLog(
"${userInfoController.model.user!}点击上传头像");
ApiResponse apiResponse =
await userInfoController.uploadImg();
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
},
child: Center(
child: Text(
'点击更换头像'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
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,
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 38.rpx), // 保持上下间距
child: Center(
child: ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor:
themeController.currentColor.sc2,
borderRadius: 8.rpx, // 可选,点击反馈更明显
padding: EdgeInsets.symmetric(
horizontal: 12.rpx,
vertical: 12.rpx), // 控制点击热区大小
onTap: () async {
edm.EasyDartModule.logger.info(
"${userInfoController.model.user!}点击上传头像");
DailyLogUtils.writeLog(
"${userInfoController.model.user!}点击上传头像");
ApiResponse apiResponse =
await userInfoController.uploadImg();
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code ==
HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
},
child: Text(
'点击更换头像'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: stringToColor("#85F5FF"),
),
].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(
child: Text(
// "AI分析介绍".tr,
"AI分析是指利用人工智能技术对用户的睡眠数据进行自动化处理与规律提取对用户的异常睡眠数据给到一定的辅助决策或者解决问题。".tr,
"AI分析是指利用人工智能技术对用户的睡眠数据进行自动化处理与规律提取对用户的异常睡眠数据给到一定的辅助决策或者解决问题。"
.tr,
style: TextStyle(
fontSize: 26.rpx,
color: themeController.currentColor.sc3,
color: Colors.black,
),
),
),
backgroundColor: Color(0xFFFFFFFF),
colors: [
Color(0XFF1592AA),
Color(0xFF0C83A7),
Color(0xFF006FA3)
],
);
},
child: Container(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -108,11 +108,22 @@ class AvgSleepScoreWidget extends StatelessWidget {
centerWidget: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
mediumLabel.tr,
style: TextStyle(
color: Colors.white,
fontSize: AppConstants().normal_text_fontSize,
// Text(
// mediumLabel.tr,
// style: TextStyle(
// color: Colors.white,
// 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(

View File

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

View File

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