1.修复睡眠日报中睡眠规律性数据显示错误

2.更新时区设置
This commit is contained in:
wyf
2026-01-07 15:19:16 +08:00
parent 36f19a71eb
commit 575f91e8dd
42 changed files with 4236 additions and 1653 deletions

View File

@@ -72,6 +72,21 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
});
}
PeopleInfoController personController = Get.find();
personController.getTimeZoneByLocalTime().then((value) {
personController.timeZone.value = value;
if (value == null || value.isEmpty) {
personController.timeZone.value = "UTC+8";
}
if (peopleList != null && peopleList.length > 0) {
ef.log("msg");
for (int i = 0; i < peopleList.length; i++) {
peopleList[i]['UTC'] = personController.timeZone.value;
}
}
personController.updateAll();
});
// 初始化城市模型列表
cityModels = List.filled(peopleList.length, CityModel());
@@ -375,7 +390,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
final diseaseIds = diseaseIdsList[i];
// 添加城市信息到person数据
person['UTC'] = cityModel.UTC;
// person['UTC'] = cityModel.UTC;
person['city_id'] = cityModel.id;
person['disease_ids'] = diseaseIds; // 添加疾病ID
@@ -917,6 +932,98 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
),
),
getLine(),
Container(
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx,
),
child: InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(
const Duration(milliseconds: 250),
() {
// 获取当前时区
String? currentTimeZone;
if (cityModels.isNotEmpty &&
index < cityModels.length) {
currentTimeZone =
cityModels[index].UTC;
}
showTimeMHTZonePickerDialog(
context,
title: "请选择时区".tr,
initialTimeZone:
currentTimeZone ?? "",
onConfirm:
(String selectedTimeZone) {
setState(() {
peopleList[index]['UTC'] =
selectedTimeZone;
});
},
);
},
);
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'请选择时区'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Obx(() {
PeopleInfoController
personController = Get.find();
var aa =
personController.timeZone.value;
return Row(
children: [
Text(
peopleList[index]['UTC'] ==
null ||
peopleList[index]
['UTC'] ==
""
? "请选择时区".tr
: peopleList[index]['UTC'],
style: TextStyle(
color: peopleList[index]
['UTC'] !=
null
? Colors
.white // 有时区时使用白色,保持和参考代码一致
: themeController
.currentColor.sc4,
fontSize: 30
.rpx, // 使用固定的30.rpx而不是AppConstants().title_text_fontSize
),
),
SizedBox(width: 16.rpx),
Icon(
Icons.expand_more,
color: Colors
.white, // 保持白色,和参考代码一致
size: 48.rpx,
),
],
);
})
],
),
),
),
getLine(),
// 慢病管理部分
Container(
height: 90.rpx,

View File

@@ -253,7 +253,7 @@ class _SettingPageState extends State<SettingPage> {
),
].divide(SizedBox(width: 22.rpx)),
),
Text('SWES2025.12.30',
Text('SWES2026.1.5',
style: TextStyle(
color: Colors.white,
fontSize: 26.rpx,

View File

@@ -142,22 +142,6 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
isValid = false;
break;
}
// if (d['UTC'] == null ||
// d['UTC'].toString().isEmpty) {
// TopSlideNotification.show(context,
// text: "请选择城市".tr,
// textColor: Color(0xFFFF7159));
// isValid = false;
// break;
// }
// if (d['city_id'] ==null ||
// d['city_id'].toString().isEmpty) {
// TopSlideNotification.show(context,
// text: "请选择城市".tr,
// textColor: Color(0xFFFF7159));
// isValid = false;
// break;
// }
}
// 所有数据合法,开始保存
if (isValid) {
@@ -890,10 +874,10 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
// 补齐并追加
list.add(newCity);
}
controller.model
.peopleList[
index]['UTC'] =
list[index].UTC;
// controller.model
// .peopleList[
// index]['UTC'] =
// list[index].UTC;
controller.model
.peopleList[
index]
@@ -952,14 +936,17 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
: "请选择城市".tr,
style: TextStyle(
color: getCityModel(
index) !=
null
index) !=
null &&
getCityModel(
index)!
.id !=
null
? themeController
.currentColor
.sc3
: themeController
.currentColor
.sc4,
: Color(
0xFF9EA4B7),
fontSize: AppConstants()
.title_text_fontSize,
),
@@ -981,6 +968,160 @@ class PeopleInfoPage extends GetView<PeopleInfoController> {
),
),
getLine(),
Container(
height: 90.rpx,
margin: EdgeInsets.only(
left: 40.rpx,
right: 35.rpx,
),
child: InkWell(
onTap: () {
// if (widget.status ==
// BindType.share.code) {
// TopSlideNotification.show(
// context,
// text: "被分享用户只能修改用户名称",
// textColor:
// themeController
// .currentColor
// .sc9);
// return;
// }
FocusScope.of(context)
.requestFocus(
FocusNode());
Future.delayed(
Duration(
milliseconds: 250),
() {
// 获取当前时区
String? currentTimeZone;
if (controller
.model
.peopleList
.isNotEmpty &&
index <
controller
.model
.peopleList
.length &&
controller.model
.peopleList[
index]['UTC'] !=
null) {
currentTimeZone =
controller.model
.peopleList[
index]['UTC'];
}
showTimeMHTZonePickerDialog(
context,
title: "请选择时区".tr,
initialTimeZone:
currentTimeZone ?? "",
onConfirm: (String
selectedTimeZone) {
controller.model
.peopleList[
index]['UTC'] =
selectedTimeZone;
},
);
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'请选择时区'.tr,
style: TextStyle(
fontFamily:
'Readex Pro',
color:
Color(0xFF9EA4B7),
fontSize: 30.rpx,
letterSpacing: 0,
),
),
Row(
children: [
Text(
controller
.model
.peopleList
.isNotEmpty &&
index <
controller
.model
.peopleList
.length &&
controller.model
.peopleList[index]
[
'UTC'] !=
null &&
controller
.model
.peopleList[
index]
[
'UTC']!
.isNotEmpty
? controller.model
.peopleList[
index]['UTC']!
: "请选择时区".tr,
style: TextStyle(
color: controller
.model
.peopleList
.isNotEmpty &&
index <
controller
.model
.peopleList
.length &&
controller.model
.peopleList[index]
[
'UTC'] !=
null &&
controller
.model
.peopleList[
index]
[
'UTC']!
.isNotEmpty
? themeController
.currentColor
.sc3
: Color(
0xFF9EA4B7),
fontSize: AppConstants()
.title_text_fontSize,
),
),
SizedBox(width: 16.rpx),
Container(
height: 30.rpx,
width: 30.rpx,
child:
SvgPicture.asset(
'assets/img/icon/expand_more.svg',
color: Colors.white,
),
),
],
),
],
),
),
),
getLine(),
Container(
height: 90.rpx,
margin: EdgeInsets.only(