1.修复睡眠日报中睡眠规律性数据显示错误
2.更新时区设置
This commit is contained in:
@@ -127,18 +127,66 @@ class BarChartPainter extends CustomPainter {
|
||||
final textPainter = TextPainter(textDirection: ui.TextDirection.ltr);
|
||||
final stepValue = maxYValue / yStepCount;
|
||||
|
||||
// Y轴刻度
|
||||
// for (int i = 0; i <= yStepCount; i++) {
|
||||
// final value = stepValue * i;
|
||||
// final y = topPadding + chartHeight - (value / maxYValue) * chartHeight;
|
||||
|
||||
// final dashPaint = Paint()
|
||||
// ..color = Colors.grey.withOpacity(0.4)
|
||||
// ..strokeWidth = 1.rpx;
|
||||
|
||||
// drawDashedLine(
|
||||
// canvas, Offset(leftPadding, y), Offset(size.width, y), dashPaint);
|
||||
|
||||
// textPainter.text = TextSpan(
|
||||
// text: value.toStringAsFixed(0),
|
||||
// style: TextStyle(
|
||||
// fontSize: 18.rpx,
|
||||
// color: themeController.currentColor.sc4,
|
||||
// ),
|
||||
// );
|
||||
// textPainter.layout();
|
||||
// textPainter.paint(
|
||||
// canvas,
|
||||
// Offset(leftPadding - textPainter.width - 4, y - textPainter.height / 2),
|
||||
// );
|
||||
// }
|
||||
// Y轴刻度
|
||||
for (int i = 0; i <= yStepCount; i++) {
|
||||
final value = stepValue * i;
|
||||
final y = topPadding + chartHeight - (value / maxYValue) * chartHeight;
|
||||
|
||||
final dashPaint = Paint()
|
||||
..color = Colors.grey.withOpacity(0.4)
|
||||
..strokeWidth = 1.rpx;
|
||||
// 判断是否是基线(i == 0)
|
||||
final bool isBaseline = i == 0;
|
||||
|
||||
drawDashedLine(
|
||||
canvas, Offset(leftPadding, y), Offset(size.width, y), dashPaint);
|
||||
if (isBaseline) {
|
||||
// 基线画实线
|
||||
final baselinePaint = Paint()
|
||||
..color = Colors.grey.withOpacity(0.6)
|
||||
..strokeWidth = 1.rpx
|
||||
..style = PaintingStyle.stroke;
|
||||
|
||||
canvas.drawLine(
|
||||
Offset(leftPadding, y),
|
||||
Offset(size.width, y),
|
||||
baselinePaint,
|
||||
);
|
||||
} else {
|
||||
// 其他刻度画虚线
|
||||
final dashPaint = Paint()
|
||||
..color = Colors.grey.withOpacity(0.4)
|
||||
..strokeWidth = 1.rpx;
|
||||
|
||||
drawDashedLine(
|
||||
canvas,
|
||||
Offset(leftPadding, y),
|
||||
Offset(size.width, y),
|
||||
dashPaint,
|
||||
);
|
||||
}
|
||||
|
||||
// 绘制刻度文字
|
||||
textPainter.text = TextSpan(
|
||||
text: value.toStringAsFixed(0),
|
||||
style: TextStyle(
|
||||
@@ -163,14 +211,14 @@ class BarChartPainter extends CustomPainter {
|
||||
final startHour = startDate.hour;
|
||||
|
||||
// 绘制X轴主线(实线)
|
||||
final xAxisPaint = Paint()
|
||||
..color = Colors.grey.withOpacity(0.4)
|
||||
..strokeWidth = 1.rpx;
|
||||
canvas.drawLine(
|
||||
Offset(leftPadding, xAxisY),
|
||||
Offset(size.width, xAxisY),
|
||||
xAxisPaint,
|
||||
);
|
||||
// final xAxisPaint = Paint()
|
||||
// ..color = Colors.grey.withOpacity(0.4)
|
||||
// ..strokeWidth = 1.rpx;
|
||||
// canvas.drawLine(
|
||||
// Offset(leftPadding, xAxisY),
|
||||
// Offset(size.width, xAxisY),
|
||||
// xAxisPaint,
|
||||
// );
|
||||
|
||||
// 绘制左右两侧时间标签(HH:mm格式)
|
||||
final leftLabel = DateFormat('HH:mm').format(startDate);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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}");
|
||||
|
||||
@@ -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')}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user