feat(flow): 新增流程图视图(时序图自动生成);导出合并为菜单并支持 drawio;发布 v1.3.0

- 流程图视图:泳道 = 轨道、FS/SS 依赖连线、关键路径高亮、相位阶段栏
  (每个动作行归属覆盖占比最大的分区,重叠分区台阶错位)
- 无前置依赖的动作从「开始」并列引出(并行分支),无后继动作汇入「结束」
- 流程图只读:AI 生成 / 撤销重做 / 动作增删 / 属性与依赖编辑等入口自动置灰,
  左栏视图模式只保留条形 / 圆周(流程图入口在顶部工具栏)
- 导出升级:导出按钮合并为下拉菜单,SVG / PNG 三种视图通用;
  流程图额外支持 drawio(diagrams.net 可继续编辑泳道 / 相位 / 依赖)
- 连线走线统一收敛到 FlowLayout.routes,画布 / SVG / drawio 共用同一几何
- 默认示例升级为完整「装配线节拍」(8 动作 / 3 工位 / 4 相位分区)
- 版本号 1.3.0+16,更新说明 release/RELEASE_NOTES_v1.3.0.md
This commit is contained in:
2026-10-09 13:59:05 +08:00
parent fe2008b604
commit f4ef9b32a5
22 changed files with 1837 additions and 281 deletions
+15 -3
View File
@@ -13,6 +13,7 @@ import 'dart:math' as math;
import 'package:flutter/material.dart' hide Action;
import '../layout/layout.dart';
import '../layout/flow_layout.dart';
import '../model/models.dart';
import '../model/units.dart';
import '../render/bar_painter.dart';
@@ -54,10 +55,14 @@ ExportFit computeExportFit(Project project, ViewMode mode, Rect area) {
final int n = l.lanes.length;
final double bottom = n == 0 ? BarLayout.topPad + BarLayout.rowVisual : l.yFor(n) + BarLayout.rowVisual + 8;
bounds = Rect.fromLTRB(12, BarPainter.phaseBandTop - 14, l.plotRight + 120, bottom);
} else {
} else if (mode == ViewMode.circular) {
final CircularLayout l = CircularLayout(project, kExportSize);
final double rExt = l.tickR + 100;
bounds = Rect.fromLTRB(l.center.dx - rExt, l.center.dy - rExt, l.center.dx + rExt, l.center.dy + rExt);
} else {
// 流程图:直接使用布局层给出的内容范围(含泳道、阶段栏与连线)。
final FlowLayout l = FlowLayout(project);
bounds = l.nodes.isEmpty ? const Rect.fromLTWH(0, 0, 800, 600) : l.bounds;
}
if (bounds.width <= 1 || bounds.height <= 1) {
return const ExportFit(1, 0, 0);
@@ -69,14 +74,21 @@ ExportFit computeExportFit(Project project, ViewMode mode, Rect area) {
}
/// 导出标题(与画布浮层一致)。
String exportTitle(ViewMode mode) =>
mode == ViewMode.bar ? '条形时序视图' : '圆周时序视图';
String exportTitle(ViewMode mode) => switch (mode) {
ViewMode.bar => '条形时序视图',
ViewMode.circular => '圆周时序视图',
ViewMode.flow => '流程图视图',
};
/// 导出副标题(与画布浮层一致)。
String exportSubtitle(Project project, ViewMode mode) {
if (mode == ViewMode.bar) {
return '箭头表示动作之间关联(绿色实线 FS 严格顺序 / 琥珀虚线 SS 并行重叠)';
}
if (mode == ViewMode.flow) {
// 流程图不重复线型说明,导出仅保留标题(与画布浮层一致)。
return '';
}
return '同心圆环 = 动作层 · 1 圈 = 1 循环 = ${tfmt(project.cycle.durationMs, project.units)} = 360° = 100%';
}