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

@@ -60,6 +60,13 @@ class _EPageState extends State<PersonPage> {
personController.weight.value = "";
personController.height.value = "";
personController.dateTime = null;
personController.cityModel = null;
personController.timeZone.value = "";
personController.getTimeZoneByLocalTime().then((value) {
personController.timeZone.value = value;
personController.updateAll();
});
cityDataFuture = cityController.loadAndSetCityData().then((success) {
return cityController.cityList;
@@ -172,7 +179,7 @@ class _EPageState extends State<PersonPage> {
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 141.rpx, 70.rpx, 0),
70.rpx, 70.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
@@ -404,30 +411,77 @@ class _EPageState extends State<PersonPage> {
}, title: "选择生日".tr);
});
},
child: Center(
child: Text(
personController.dateTime != null
? DateFormat("yyyy/MM/dd").format(
personController.dateTime!)
: '人员资料.生日输入提示'.tr,
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController.dateTime != null
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
child: Stack(
children: [
// 文字居中
Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: personController
.dateTime !=
null
? DateFormat(
"yyyy/MM/dd")
.format(
personController
.dateTime!)
: '人员资料.生日输入提示'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController
.dateTime !=
null
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
TextSpan(
text: ' *',
style: TextStyle(
color: themeController
.currentColor.sc9,
fontSize: AppConstants()
.normal_text_fontSize,
fontWeight:
FontWeight.bold,
),
),
],
),
),
],
),
),
),
// 箭头居右
Positioned(
right: 30.rpx,
top: 0,
bottom: 0,
child: Icon(
Icons.expand_more,
color:
themeController.currentColor.sc4,
size: 30.rpx,
),
),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0),
70.rpx, 25.rpx, 70.rpx, 0),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
@@ -464,31 +518,76 @@ class _EPageState extends State<PersonPage> {
);
});
},
child: Center(
child: Text(
personController.height.value != ""
? personController.height.value +
"cm".tr
: '身高输入提示'.tr,
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController.height.value !=
""
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
child: Stack(
children: [
// 文字居中
Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: personController
.height.value !=
""
? personController
.height.value +
"cm".tr
: '身高输入提示'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController
.height
.value !=
""
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
TextSpan(
text: ' *',
style: TextStyle(
color: themeController
.currentColor.sc9,
fontSize: AppConstants()
.normal_text_fontSize,
fontWeight:
FontWeight.bold,
),
),
],
),
),
],
),
),
),
// 箭头居右
Positioned(
right: 30.rpx,
top: 0,
bottom: 0,
child: Icon(
Icons.expand_more,
color:
themeController.currentColor.sc4,
size: 30.rpx,
),
),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0),
70.rpx, 25.rpx, 70.rpx, 0),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
@@ -512,38 +611,184 @@ class _EPageState extends State<PersonPage> {
personController.weight.value ?? "",
onConfirm: (int selectedWeight) {
personController.weight.value =
selectedWeight
.toString(); // ✅ 转成字符串
selectedWeight.toString();
personController.updateAll();
},
);
});
},
child: Center(
child: Text(
personController.weight.value != ""
? personController.weight.value +
"kg".tr
: '人员资料.体重输入提示'.tr,
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController.weight.value !=
""
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
child: Stack(
children: [
// 文字居中
Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: personController
.weight.value !=
""
? personController
.weight.value +
"kg".tr
: '人员资料.体重输入提示'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController
.weight
.value !=
""
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
TextSpan(
text: ' *',
style: TextStyle(
color: themeController
.currentColor.sc9,
fontSize: AppConstants()
.normal_text_fontSize,
fontWeight:
FontWeight.bold,
),
),
],
),
),
],
),
),
),
// 箭头居右
Positioned(
right: 30.rpx,
top: 0,
bottom: 0,
child: Icon(
Icons.expand_more,
color:
themeController.currentColor.sc4,
size: 30.rpx,
),
),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0),
70.rpx, 25.rpx, 70.rpx, 0),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: InkWell(onTap: () {
final timeZone =
personController.timeZone.value;
final initialTimeZone = timeZone;
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(
const Duration(milliseconds: 250), () {
showTimeZonePickerDialog(
context,
title: "选择时区".tr,
initialTimeZone: initialTimeZone,
onConfirm: (String selectedtimezone) {
personController.timeZone.value =
selectedtimezone.toString();
personController.updateAll();
print("时区: $selectedtimezone");
},
);
});
}, child: Obx(() {
return Stack(
children: [
// 文字居中
Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: personController
.timeZone
.value !=
""
? personController
.timeZone.value
: '选择时区'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController
.timeZone
.value !=
""
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
TextSpan(
text: ' *',
style: TextStyle(
color: themeController
.currentColor.sc9,
fontSize: AppConstants()
.normal_text_fontSize,
fontWeight:
FontWeight.bold,
),
),
],
),
),
],
),
),
// 箭头居右
Positioned(
right: 30.rpx,
top: 0,
bottom: 0,
child: Icon(
Icons.expand_more,
color:
themeController.currentColor.sc4,
size: 30.rpx,
),
),
],
);
})),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 25.rpx, 70.rpx, 0),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
@@ -577,32 +822,77 @@ class _EPageState extends State<PersonPage> {
title: "选择城市".tr,
cityDataFuture:
cityDataFuture, // 传入预加载的数据
colors: CitySelectionColors(
// pickerBackgroundColor:
// stringToColor("#003058"),
// confirmTextColor:
// stringToColor("#84F5FF"),
selectedCityColor:
themeController.currentColor.sc2,
selectedTextColor: Colors.white,
),
);
});
},
child: Center(
child: Text(
_getDetailedCityDisplayText(
personController.cityModel),
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',
color: personController.cityModel !=
null
? themeController.currentColor.sc3
: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0,
child: Stack(
children: [
// 文字居中
Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_getDetailedCityDisplayText(
personController.cityModel),
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Readex Pro',
color:
personController
.cityModel !=
null
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
// Text(
// ' *',
// style: TextStyle(
// color: themeController
// .currentColor.sc9,
// fontSize: AppConstants()
// .normal_text_fontSize,
// fontWeight: FontWeight.bold,
// ),
// ),
],
),
),
),
// 箭头居右
Positioned(
right: 30.rpx,
top: 0,
bottom: 0,
child: Icon(
Icons.expand_more,
color:
themeController.currentColor.sc4,
size: 30.rpx,
),
),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 117.rpx, 0, 0),
0, 60.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),