|
...
|
...
|
@@ -383,7 +383,8 @@ class TodayHrvChartCard extends StatelessWidget { |
|
|
|
text: isWorkout == true ? '◉ ' : '○ ',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: _getColorByState(state),
|
|
|
|
color:
|
|
|
|
isWorkout == true ? Color(0xFF78787D) : _getColorByState(state),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
inherit: false,
|
|
|
|
fontFamilyFallback: null,
|
|
...
|
...
|
@@ -396,7 +397,9 @@ class TodayHrvChartCard extends StatelessWidget { |
|
|
|
: '${_getStatusByState(state)} ${_formatNumber(rod.toY)}%',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18,
|
|
|
|
color: _getColorByState(state),
|
|
|
|
color: isWorkout == true
|
|
|
|
? const Color(0xFF78787D)
|
|
|
|
: _getColorByState(state),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
...
|
...
|
@@ -1144,7 +1147,7 @@ class _StressBarChartState extends State<_StressBarChart> { |
|
|
|
),
|
|
|
|
if (customIndicator != null)
|
|
|
|
customIndicator, // 将指示线移动到 Container (BarChart) 之后绘制,防止被盖住
|
|
|
|
...sleepWidgets,
|
|
|
|
if (widget.stressPoints.isNotEmpty) ...sleepWidgets,
|
|
|
|
// 手绘 100、50、0 标签在对应的横线上方
|
|
|
|
Positioned(
|
|
|
|
right: -5,
|
|
...
|
...
|
@@ -1185,15 +1188,15 @@ class _StressBarChartState extends State<_StressBarChart> { |
|
|
|
const slotSec = 6 * 60; // 360 秒 = 6 分钟
|
|
|
|
final maxSec = widget.maxSeconds.round();
|
|
|
|
|
|
|
|
// 按槽分组,记录每槽的最大 value 及对应的 state
|
|
|
|
final slotMax = <int, ({int value, int? state})>{};
|
|
|
|
// 按槽分组,记录每槽的最大 value 及对应的 state / isWorkout
|
|
|
|
final slotMax = <int, ({int value, int? state, int? isWorkout})>{};
|
|
|
|
for (final p in stressPoints) {
|
|
|
|
final sec = TodayHrvChartCard._tsToSecondsFromMidnight(p.time).round();
|
|
|
|
final slot = (sec / slotSec).round() * slotSec;
|
|
|
|
final v = p.value ?? 0;
|
|
|
|
final existing = slotMax[slot];
|
|
|
|
if (existing == null || v > existing.value) {
|
|
|
|
slotMax[slot] = (value: v, state: p.state);
|
|
|
|
slotMax[slot] = (value: v, state: p.state, isWorkout: p.isWorkout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -1211,7 +1214,9 @@ class _StressBarChartState extends State<_StressBarChart> { |
|
|
|
toY: entry != null ? entry.value.toDouble() : 0,
|
|
|
|
width: barWidth,
|
|
|
|
color: entry != null
|
|
|
|
? widget.getColorByState(entry.state)
|
|
|
|
? (entry.isWorkout == 1
|
|
|
|
? const Color(0xFF78787D)
|
|
|
|
: widget.getColorByState(entry.state))
|
|
|
|
: Colors.transparent,
|
|
|
|
borderRadius: BorderRadius.circular(barWidth / 2),
|
|
|
|
),
|
...
|
...
|
|