页面UI替换1远程遥控和各项弹窗和作业主页面和子页面+路径规划的主页面重构等

This commit is contained in:
2026-10-28 14:38:24 +08:00
parent 8a41113c92
commit eb8dec2868
64 changed files with 25316 additions and 1174 deletions

View File

@@ -99,7 +99,8 @@ class _GuidePainter extends CustomPainter {
final double rootHalf = w * 0.16;
final double farHalf = w * 0.30;
final Color color = _colorByDistance(data.rearDistanceCm);
// 横向刻度的警告色仍按测距变化(红/黄/绿),与原来语义一致
final Color warnColor = _colorByDistance(data.rearDistanceCm);
// 中心线沿法线各偏移半宽 = 左右导轨(近窄远宽,转弯时通道宽度守恒)
Offset rail(int i, double sign) {
@@ -109,36 +110,89 @@ class _GuidePainter extends CustomPainter {
return pts[i] + normal * (half * sign);
}
final Paint sidePaint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = math.max(3.0, w * 0.006)
..strokeCap = StrokeCap.round
..color = color
..maskFilter = const MaskFilter.blur(BlurStyle.solid, 2);
for (final double sign in const <double>[-1.0, 1.0]) {
Path railPath(double sign) {
final Offset p0 = rail(0, sign);
final Path path = Path()..moveTo(p0.dx, p0.dy);
for (int i = 1; i <= steps; i++) {
final Offset r = rail(i, sign);
path.lineTo(r.dx, r.dy);
}
canvas.drawPath(path, sidePaint);
return path;
}
final Paint dashPaint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = math.max(2.0, w * 0.004)
..color = color.withValues(alpha: 0.9);
// ① 左右导轨:由“细线”改为**分段色带**(倒车影像标准标尺)——
// 远端红 → 中段黄 → 近端绿,并沿纵向做透明度渐变(远端淡出),
// 再用“模糊光晕 + 实色芯”两层叠加做出边缘虚化的发光感。
// 路径仍是同一批采样点,引导线走向 / 弯曲 / 宽度轮廓完全不变。
final double bandW = math.max(5.0, w * 0.024);
final Shader rulerShader = const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[
Color(0x00FF4D4D), // 远端:红,完全淡出
Color(0xCCFF4D4D), // 红标尺
Color(0xE6FFC61A), // 黄标尺
Color(0xF235D07F), // 近端:绿,最实
],
stops: <double>[0.0, 0.32, 0.56, 0.80],
).createShader(Rect.fromLTRB(0, h * _farT, w, bottomY));
// 横向刻度线:沿法线连接左右导轨;每条错开相位,虚线像“往外流动”
for (final double sign in const <double>[-1.0, 1.0]) {
final Path path = railPath(sign);
// 外层:宽一圈的模糊光晕(渐变虚化)
canvas.drawPath(
path,
Paint()
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round
..strokeWidth = bandW * 1.9
..shader = rulerShader
..maskFilter = MaskFilter.blur(BlurStyle.normal, bandW * 0.55),
);
// 内层:实色带(形状明确,不依赖模糊)
canvas.drawPath(
path,
Paint()
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round
..strokeWidth = bandW
..shader = rulerShader,
);
}
// ② 横向刻度:加粗成“横带”,越近越粗越实;两端向外渐隐 + 轻微模糊,
// 保留原来沿流动虚线的动画(相位仍由 _ticker 驱动)。
const List<double> stops = [0.0, 0.34, 0.63, 0.86];
for (int k = 0; k < stops.length; k++) {
final int i = (stops[k] * steps).round().clamp(0, steps);
final Offset a = rail(i, -1.0);
final Offset b = rail(i, 1.0);
final double f = i / steps;
final double alpha = 0.30 + 0.65 * f;
final Paint dashPaint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = math.max(3.0, w * (0.006 + 0.012 * f))
..strokeCap = StrokeCap.round
// 两端淡出:从导轨内侧向外渐隐,像参考图那样“融入画面”
..shader = LinearGradient(
colors: <Color>[
warnColor.withValues(alpha: 0.0),
warnColor.withValues(alpha: alpha),
warnColor.withValues(alpha: alpha),
warnColor.withValues(alpha: 0.0),
],
stops: const <double>[0.0, 0.24, 0.76, 1.0],
).createShader(Rect.fromPoints(a, b))
..maskFilter = MaskFilter.blur(
BlurStyle.normal,
math.max(0.8, w * 0.0025),
);
_drawDashedLine(
canvas,
rail(i, -1.0),
rail(i, 1.0),
a,
b,
dashPaint,
(dashPhase + k * 0.25) % 1.0,
);