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
Reference in New Issue
Block a user