feat: 原创「环序」标志;双视图与侧栏优化;工位管理;帮助完善

- 原创应用标志「环序/Cycle-Step」:tools/gen-icon.py 重写 + 工具栏 Logo 同源,小尺寸简化版

- 条形时序视图:标题/副标题精简、双刻度值置于分区与刻度线之间、时间默认内嵌、依赖线箭头收窄、同泳道箭头接色块外侧、图注自动避让

- 圆周时序视图:去掉色块描边、环宽与间隙优化、度数外侧标时间、方向箭头外移;固定顺时针(移除逆时针)

- 左侧栏:编辑工位/编辑相位分区入口;双击画布色块或动作行进入编辑;至少保留一个动作/泳道

- 右侧栏:移除重复的编辑操作、导出与单位卡片;文件浏览器新增「桌面」快捷入口

- AI 对话框:字号优化并新增「编辑示例」;节拍统计移除无依据的预估产能

- 文档:README 与 docs/HELP.md 全面更新;dist 同步重建
This commit is contained in:
admin
2026-09-18 23:32:36 +08:00
parent 71e84e05aa
commit 43c99fc4b6
18 changed files with 1079 additions and 779 deletions
+36 -50
View File
@@ -17,6 +17,7 @@ import 'package:flutter/material.dart' hide Action;
import '../layout/layout.dart';
import '../model/models.dart';
import '../model/units.dart';
import '../theme/tokens.dart';
/// 圆形视图的 [CustomPainter] 实现。
@@ -118,9 +119,6 @@ class CircularPainter extends CustomPainter {
// 相位分区环:在最外动作环与刻度环之间画一圈分区色带并标注名称。
if (project.viewState.showPhaseBands) _phaseRing(canvas, layout);
// 象限辅助线(0°/90°/180°/270°)。
_quadrants(canvas, c, layout);
// 轨道标签:为每条轨道挑选一个空位角度,避免压住该轨道的动作弧。
if (project.viewState.showLayerLabels) {
for (int i = 0; i < layers; i++) {
@@ -148,9 +146,9 @@ class CircularPainter extends CustomPainter {
// 拖拽端点时的径向虚线参考。
if (guideAngle != null) _guide(canvas, layout);
// 起点标记、顺时针方向提示与外围刻度。
// 起点标记、循环方向提示与外围刻度。
_startMarker(canvas, layout);
_cwArrow(canvas, layout);
_directionArrow(canvas, layout);
if (project.viewState.showRuler) _ticks(canvas, layout);
}
@@ -285,21 +283,6 @@ class CircularPainter extends CustomPainter {
return n >= a.startAngle - 0.5 || n <= (a.endAngle - 360) + 0.5;
}
/// 绘制 0°/90°/180°/270° 四条象限辅助线(从内圈延伸到刻度环)。
void _quadrants(Canvas canvas, Offset c, CircularLayout layout) {
for (final double d in <double>[0, 90, 180, 270]) {
final Offset p1 = polar(c, 30, d);
final Offset p2 = polar(c, layout.tickR + 4, d);
canvas.drawLine(
p1,
p2,
Paint()
..color = tokens.line2.withValues(alpha: 0.7)
..strokeWidth = 1,
);
}
}
/// 绘制单个动作弧。
///
/// 算法:
@@ -325,14 +308,7 @@ class CircularPainter extends CustomPainter {
// 第二段且为跨循环时视为“尾巴”,需淡化处理。
final bool tail = a.wrap && k == 1;
final Path p = arcPath(c, r, segs[k][0], segs[k][1]);
canvas.drawPath(
p,
Paint()
..style = PaintingStyle.stroke
..strokeWidth = th + 7
..strokeCap = a.wrap ? StrokeCap.butt : StrokeCap.round
..color = tokens.shadow.withValues(alpha: tokens.shadowOp),
);
// 圆周色块不加描边 / 阴影,保持干净。
canvas.drawPath(
p,
Paint()
@@ -446,7 +422,7 @@ class CircularPainter extends CustomPainter {
p,
Paint()
..style = PaintingStyle.stroke
..strokeWidth = 9
..strokeWidth = 5
..strokeCap = StrokeCap.round
..color = col.withValues(alpha: 0.2),
);
@@ -455,7 +431,7 @@ class CircularPainter extends CustomPainter {
p,
Paint()
..style = PaintingStyle.stroke
..strokeWidth = crit ? 3 : (d.type == DepType.fs ? 2.4 : 2)
..strokeWidth = crit ? 1.2 : (d.type == DepType.fs ? 1.0 : 0.9)
..strokeCap = StrokeCap.round
..color = col,
);
@@ -482,7 +458,7 @@ class CircularPainter extends CustomPainter {
final double len = dir.distance;
if (len < 0.001) return;
final Offset u = dir / len;
const double s = 12;
const double s = 6;
final Offset b = tip - u * s;
final Offset n = Offset(-u.dy, u.dx) * s * 0.5;
final Path p = Path()
@@ -535,40 +511,46 @@ class CircularPainter extends CustomPainter {
color: tokens.accent, size: 11, align: TextAlign.center, weight: FontWeight.w600);
}
/// 绘制顺时针方向指示:一段外圈圆弧、箭头与“顺时针 CW”文字。
void _cwArrow(Canvas canvas, CircularLayout layout) {
/// 绘制循环方向指示:外圈一段短弧 + 沿切线的箭头,标注顺时针。
void _directionArrow(Canvas canvas, CircularLayout layout) {
final Offset c = layout.center;
// 放在刻度数字之外更远处,避免“冲进”视图内部。
final double r = layout.tickR + 56;
final Path p = arcPath(c, r, 20, 70);
// 放在度数 / 时间两排标签之外,避免箭头与文字相撞。
final double r = layout.tickR + 72;
canvas.drawPath(
p,
arcPath(c, r, 25, 60),
Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2.4
..strokeWidth = 1.8
..strokeCap = StrokeCap.round
..color = tokens.accent2,
);
final Offset t1 = polar(c, r, 74);
final Offset t2 = polar(c, r + 14, 68);
final Offset t3 = polar(c, r - 14, 66);
final Path a = Path()
..moveTo(t1.dx, t1.dy)
..lineTo(t2.dx, t2.dy)
..lineTo(t3.dx, t3.dy)
// 箭头指向弧的终点,方向与切线一致(顺时针)。
const double te = 60;
final double trad = te * math.pi / 180;
final Offset tip = polar(c, r, te);
final Offset tan = Offset(math.cos(trad), math.sin(trad));
const double s = 7;
final Offset b = tip - tan * s;
final Offset n = Offset(-tan.dy, tan.dx) * s * 0.5;
final Path head = Path()
..moveTo(tip.dx, tip.dy)
..lineTo(b.dx + n.dx, b.dy + n.dy)
..lineTo(b.dx - n.dx, b.dy - n.dy)
..close();
canvas.drawPath(a, Paint()..color = tokens.accent2);
final Offset label = polar(c, r + 30, 45);
_text(canvas, '顺时针 CW', label, color: tokens.accent2, size: 11, align: TextAlign.center, weight: FontWeight.w600);
canvas.drawPath(head, Paint()..color = tokens.accent2);
_text(canvas, '顺时针 CW', polar(c, r + 20, 42),
color: tokens.accent2, size: 10, align: TextAlign.center, weight: FontWeight.w600);
}
/// 绘制外围角度刻度。
///
/// 每 5° 一个刻度,10° 为中刻度,30° 为主刻度并标注度数;
/// 90° 的整数倍使用强调色加粗,便于快速定位象限。
/// 90° 的整数倍使用强调色加粗。度数外侧再标注等价的绝对时间。
void _ticks(Canvas canvas, CircularLayout layout) {
final Offset c = layout.center;
final double r = layout.tickR;
final UnitSettings u = project.units;
final double cycle = project.cycle.durationMs;
for (int d = 0; d < 360; d += 5) {
final bool major = d % 30 == 0;
final bool mid = d % 10 == 0;
@@ -582,12 +564,16 @@ class CircularPainter extends CustomPainter {
..color = major ? tokens.line2 : tokens.line,
);
if (major) {
final Offset lp = polar(c, r + 38, d.toDouble());
final Offset lp = polar(c, r + 34, d.toDouble());
_text(canvas, '$d°', lp,
color: d % 90 == 0 ? tokens.accent : tokens.sub,
size: 10,
align: TextAlign.center,
weight: d % 90 == 0 ? FontWeight.w700 : FontWeight.normal);
// 度数外侧增加一个时间数值(字号与度数保持一致)。
final Offset tp = polar(c, r + 48, d.toDouble());
_text(canvas, tvalStr(d / 360 * cycle, u, dec: u.timeUnit == TimeUnit.ms ? 0 : 1), tp,
color: tokens.sub, size: 10, align: TextAlign.center);
}
}
}