Commit 7a2897c29950850f3bf2c44b23998893819fa46e

Authored by 常守达
1 parent d1e329b8

fix(today):图标展示修改

... ... @@ -533,10 +533,11 @@ class _HrvLineChartState extends State<_HrvLineChart> {
Widget build(BuildContext context) {
return LineChart(
LineChartData(
clipData: const FlClipData.none(),
minX: 0,
maxX: widget.maxSeconds,
minY: 0,
maxY: 80,
maxY: 100,
gridData: FlGridData(
show: true,
drawVerticalLine: true,
... ... @@ -624,7 +625,7 @@ class _HrvLineChartState extends State<_HrvLineChart> {
],
lineTouchData: LineTouchData(
getTouchLineStart: (barData, spotIndex) => 0,
getTouchLineEnd: (barData, spotIndex) => 90,
getTouchLineEnd: (barData, spotIndex) => 100,
handleBuiltInTouches: false,
touchSpotThreshold: 20.0,
touchCallback:
... ... @@ -685,7 +686,7 @@ class _HrvLineChartState extends State<_HrvLineChart> {
touchTooltipData: LineTouchTooltipData(
tooltipRoundedRadius: 8,
showOnTopOfTheChartBoxArea: true,
tooltipMargin: 6,
tooltipMargin: 0,
tooltipBorder: BorderSide.none,
maxContentWidth: 400,
fitInsideHorizontally: true,
... ... @@ -903,20 +904,23 @@ class _StressBarChartState extends State<_StressBarChart> {
// 自定义指示线 (只在 Stack 层手绘一条垂直灰色指示线,与柱子对齐,高度到达顶部以与 tooltip 连上)
Positioned? customIndicator;
if (_stressTouchedGroupIndex != null) {
final stepWidth = barWidth + groupsSpace;
final centerOfBar =
_stressTouchedGroupIndex! * stepWidth + (barWidth / 2);
customIndicator = Positioned(
left: centerOfBar - 1.0, // 2px 宽度,居中
width: 2.0,
top: 16.0, // 向上延展以连接 tooltip 底部
bottom: chartHeight - gridBottom, // 修正:bottom 指的是距离 Stack 底部的像素值
child: IgnorePointer(
child: ColoredBox(
color: context.colors.textTertiary.withAlpha(125),
final touchedSec = _stressTouchedGroupIndex! * slotSec;
if (slotStateMap.containsKey(touchedSec)) {
final stepWidth = barWidth + groupsSpace;
final centerOfBar =
_stressTouchedGroupIndex! * stepWidth + (barWidth / 2);
customIndicator = Positioned(
left: centerOfBar - 1.0, // 2px 宽度,居中
width: 2.0,
top: 12.0, // 向上延展以连接 tooltip 底部
bottom: chartHeight - gridBottom, // 修正:bottom 指的是距离 Stack 底部的像素值
child: IgnorePointer(
child: ColoredBox(
color: context.colors.textTertiary.withAlpha(125),
),
),
),
);
);
}
}
return Stack(
... ...