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,