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

@@ -98,8 +98,9 @@ class _BreatheCardState extends State<BreatheCard>
BorderRadius.circular(AppConstants().normal_container_radius),
),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
// padding:
// EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
padding: EdgeInsets.all(0),
child: Wrap(
spacing: 23.rpx,
runSpacing: 25.rpx,
@@ -110,7 +111,8 @@ class _BreatheCardState extends State<BreatheCard>
_shouldAnimate && item['id'] == _highlightedId;
return SizedBox(
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
// width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
width: (MediaQuery.of(context).size.width - 120.rpx) / 3,
child: AnimatedBuilder(
animation: _animationController ?? AlwaysStoppedAnimation(0),
builder: (context, child) {
@@ -137,7 +139,7 @@ class _BreatheCardState extends State<BreatheCard>
),
);
} catch (e) {
es.EasyDartModule.logger.error("呼吸监测绘制异常${e}");
es.EasyDartModule.logger.error("呼吸卡片绘制异常${e}");
return Container();
}
}

View File

@@ -100,15 +100,17 @@ class _HeartRateCardState extends State<HeartRateCard>
}).toList(); // 添加 .toList()
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius:
BorderRadius.circular(AppConstants().normal_container_radius),
),
// 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),
// padding:
// EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
padding: EdgeInsets.all(0),
child: Wrap(
alignment: WrapAlignment.spaceBetween,
spacing: 23.rpx,
runSpacing: 25.rpx,
children: List.generate(data.length, (index) {
@@ -118,7 +120,7 @@ class _HeartRateCardState extends State<HeartRateCard>
_shouldAnimate && item['id'] == _highlightedId;
return SizedBox(
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
width: (MediaQuery.of(context).size.width - 120.rpx) / 3,
child: AnimatedBuilder(
animation: _animationController ?? AlwaysStoppedAnimation(0),
builder: (context, child) {
@@ -145,7 +147,7 @@ class _HeartRateCardState extends State<HeartRateCard>
),
);
} catch (e) {
es.EasyDartModule.logger.error("心率监测绘制异常${e}");
es.EasyDartModule.logger.error("心率卡片绘制异常${e}");
return Container();
}
}

View File

@@ -136,7 +136,8 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
14.rpx, 10.rpx, 14.rpx, 10.rpx), //
borderRadius: 0.rpx, // 圆形点击区域
onTap: () {
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (AppConstants().ent_type ==
APPPackageType.MHT.code) {
showTipDialog(
context,
Container(

View File

@@ -104,54 +104,41 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
.where((item) => item['show'] != false)
.toList();
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: Wrap(
alignment: WrapAlignment.center,
spacing: 23.rpx,
runSpacing: 25.rpx,
children: List.generate(data.length, (index) {
final item = data[index];
item['showTip'] = true;
final bool isHighlighted =
_shouldAnimate && item['id'] == _highlightedId;
return SizedBox(
width: (MediaQuery.of(context).size.width - 160.rpx) / num,
child: AnimatedBuilder(
animation: _animationController ?? AlwaysStoppedAnimation(0),
builder: (context, child) {
return Container(
key: isHighlighted ? _highlightKey : null,
decoration: isHighlighted
? BoxDecoration(
border: Border.all(
color: themeController.currentColor.sc2
.withOpacity(
_animationController?.value ?? 0),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8),
)
: null,
child: SleepDataModuleWidget(
data: item,
sleepReportData: widget.sleepReport,
),
);
},
),
);
}),
),
),
return Wrap(
alignment: WrapAlignment.spaceBetween,
spacing: 23.rpx,
runSpacing: 25.rpx,
children: List.generate(data.length, (index) {
final item = data[index];
item['showTip'] = true;
final bool isHighlighted =
_shouldAnimate && item['id'] == _highlightedId;
return SizedBox(
width: (MediaQuery.of(context).size.width - 120.rpx) / num,
child: AnimatedBuilder(
animation: _animationController ?? AlwaysStoppedAnimation(0),
builder: (context, child) {
return Container(
key: isHighlighted ? _highlightKey : null,
decoration: isHighlighted
? BoxDecoration(
border: Border.all(
color: themeController.currentColor.sc2
.withOpacity(_animationController?.value ?? 0),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8),
)
: null,
child: SleepDataModuleWidget(
data: item,
sleepReportData: widget.sleepReport,
),
);
},
),
);
}),
);
} catch (e) {
es.EasyDartModule.logger.error("数据卡片渲染异常${e}");

View File

@@ -70,6 +70,22 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
// "name": "rem",
// "color": "#FFC0CB",
// });
// List typeZeroStages =
// stages.where((stage) => stage['type'] == 0).toList();
// List snoreStages = stages.where((stage) => stage['type'] == 5).toList();
// for (int i = 0; i < typeZeroStages.length; i++) {
// var stage = typeZeroStages[i];
// int st = stage['st'];
// int et = stage['et'];
// // 转换为DateTime
// DateTime stDate = DateTime.fromMillisecondsSinceEpoch(st);
// DateTime etDate = DateTime.fromMillisecondsSinceEpoch(et);
// // 一行打印所有信息
// print(
// '离床元素 ${i + 1}: st=${formatDate(stDate)} et=${formatDate(etDate)}');
// }
return Container(
width: double.infinity,
@@ -306,7 +322,7 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
),
),
SizedBox(
height: 49.rpx,
height: 70.rpx,
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
@@ -359,8 +375,13 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
),
);
} catch (e) {
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
es.EasyDartModule.logger.error("睡眠规律性异常${e}");
return Container();
}
}
String formatDate(DateTime date) {
return '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')} '
'${date.hour.toString().padLeft(2, '0')}:${date.minute.toString().padLeft(2, '0')}:${date.second.toString().padLeft(2, '0')}';
}
}