feat(V1.0.1): 泳道/轨道支持多动作(同执行器多条不重叠);圆周弧可拖拽端点;依赖标签沿弧避让
- 泳道模型:layer 兼作泳道/轨道编号,同一泳道可放多个互不重叠动作(角区间重叠校验) - 条形:上下拖拽换道;圆周:Shift+径向拖拽换轨;冲突时拒绝并提示 - 泳道标题合并显示(/ 分隔,≤2 行);左侧列表按泳道分组 - 圆周动作弧支持拖拽两端改起止角(弱吸附 + 径向虚线参考),整体拖拽旋转 - 圆周依赖标签沿圆弧切向排布,落入环间空隙,避免压住动作弧 - 版本 1.0.1+2;帮助/README 补充泳道说明;重新构建 dist
This commit is contained in:
+124
-5
@@ -968,7 +968,7 @@ class _AppShellState extends State<AppShell> {
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: _sectionLabel(t, bar ? '动作 / 工位泳道' : '动作列表(按层 L1→L${c.project.maxLayer + 1})'),
|
||||
child: _sectionLabel(t, bar ? '动作 / 执行器泳道' : '动作列表(按轨道 L1→L${c.project.laneCount})'),
|
||||
),
|
||||
const Spacer(),
|
||||
_headerAction(t, Icons.add, '新建', t.ok, t.onAccent, () => c.addAction(startAngle: 0)),
|
||||
@@ -984,7 +984,8 @@ class _AppShellState extends State<AppShell> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
for (int i = 0; i < actions.length; i++) _actionRow(t, actions[i], i, bar),
|
||||
// 按泳道 / 轨道分组:同一泳道内的多个动作合并显示(最多两行,/ 分隔)。
|
||||
..._laneRows(t, bar),
|
||||
const SizedBox(height: 12),
|
||||
_sectionLabel(t, '视图模式'),
|
||||
const SizedBox(height: 8),
|
||||
@@ -1080,6 +1081,124 @@ class _AppShellState extends State<AppShell> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 左侧栏:按泳道 / 轨道分组的行列表。
|
||||
List<Widget> _laneRows(Tokens t, bool bar) {
|
||||
final List<int> lanes = <int>{for (final Action a in c.project.actions) a.layer}.toList()..sort();
|
||||
final List<Widget> out = <Widget>[];
|
||||
for (int li = 0; li < lanes.length; li++) {
|
||||
final int lane = lanes[li];
|
||||
final List<Action> acts = c.project.actions.where((Action a) => a.layer == lane).toList()
|
||||
..sort((Action a, Action b) => a.startAngle.compareTo(b.startAngle));
|
||||
// 单动作泳道沿用普通动作行;多动作泳道合并显示。
|
||||
out.add(acts.length == 1
|
||||
? _actionRow(t, acts.first, li, bar)
|
||||
: _laneRow(t, lane, li, acts, bar));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/// 单条泳道 / 轨道行:多个动作合并显示(≤2 行,/ 分隔)。
|
||||
Widget _laneRow(Tokens t, int lane, int li, List<Action> acts, bool bar) {
|
||||
if (acts.isEmpty) return const SizedBox.shrink();
|
||||
final Action primary =
|
||||
acts.firstWhere((Action a) => c.isSelected(a.id), orElse: () => acts.first);
|
||||
final bool sel = c.isSelected(primary.id);
|
||||
final Station? st = c.project.stationById(primary.stationId);
|
||||
final String joined = acts.map((Action a) => '${a.id} ${a.name}').join(' / ');
|
||||
double a0 = acts.first.startAngle;
|
||||
double a1 = acts.first.endAngle;
|
||||
for (final Action a in acts) {
|
||||
a0 = math.min(a0, a.startAngle);
|
||||
a1 = math.max(a1, a.endAngle);
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: InkWell(
|
||||
onTap: () => c.select(
|
||||
primary.id,
|
||||
toggle: HardwareKeyboard.instance.isControlPressed ||
|
||||
HardwareKeyboard.instance.isShiftPressed,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: sel ? t.sel : t.panel2,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: sel ? t.accent : t.line, width: sel ? 1.4 : 1),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 22,
|
||||
height: 22,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(primary.color).withValues(alpha: 0.9),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text('${li + 1}', style: TextStyle(color: t.chip, fontSize: 11, fontWeight: FontWeight.w700)),
|
||||
),
|
||||
const SizedBox(width: 9),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
joined,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: sel ? t.text : t.text2,
|
||||
fontSize: 12.5,
|
||||
height: 1.25,
|
||||
fontWeight: sel ? FontWeight.w600 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${st?.name ?? primary.stationId} · ${primary.driver}'
|
||||
'${acts.length > 1 ? ' · 共 ${acts.length} 个' : ''}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: t.dim, fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
bar ? '${a0.toStringAsFixed(0)}° – ${math.min(a1, 360).toStringAsFixed(0)}°' : 'L${li + 1}',
|
||||
style: TextStyle(color: t.sub, fontSize: 11),
|
||||
),
|
||||
Text('${acts.length} 个动作', style: TextStyle(color: t.dim, fontSize: 10)),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
InkWell(
|
||||
onTap: () => showDialog<void>(
|
||||
context: context, builder: (_) => ActionEditorDialog(controller: c, action: primary)),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
child: Container(
|
||||
width: 28,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
border: Border.all(color: t.line2),
|
||||
),
|
||||
child: Icon(Icons.edit, size: 13, color: sel ? t.accent : t.dim),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 左侧栏中的单条动作行:点击选中,右侧显示相位/层信息与编辑入口。
|
||||
Widget _actionRow(Tokens t, Action a, int i, bool bar) {
|
||||
final bool sel = c.isSelected(a.id);
|
||||
@@ -1367,7 +1486,7 @@ class _AppShellState extends State<AppShell> {
|
||||
else ...<Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(child: _wideBtn(t, Icons.add, '新增外层 L${c.project.maxLayer + 2}', t.accent2, Colors.white,
|
||||
Expanded(child: _wideBtn(t, Icons.add, '新增轨道 L${c.project.laneCount + 1}', t.accent2, Colors.white,
|
||||
() => c.changeLayer(a.id, 1))),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: _wideBtn(t, Icons.keyboard_arrow_up, '重排 / 合并层', t.panel2, t.sub,
|
||||
@@ -1882,8 +2001,8 @@ class _AppShellState extends State<AppShell> {
|
||||
'相位 360° = 100%',
|
||||
'动作 ${c.project.actions.length}',
|
||||
'依赖 ${_depCount()}',
|
||||
circular ? '层数 L1–L${c.project.maxLayer + 1}' : '工位 ${c.project.stations.length}',
|
||||
circular ? '同心圆 ${c.project.maxLayer + 1}' : '时间轴 0–${tfmt(c.project.cycle.durationMs, u)}',
|
||||
circular ? '轨道 L1–L${c.project.laneCount}' : '工位 ${c.project.stations.length}',
|
||||
circular ? '同心圆 ${c.project.laneCount}' : '时间轴 0–${tfmt(c.project.cycle.durationMs, u)}',
|
||||
'单位 ${timeUnitLabel(u.timeUnit)} / ${phaseUnitLabel(u.phaseUnit)}',
|
||||
'1° = ${tfmtAuto(c.project.cycle.durationMs / 360)}',
|
||||
c.status,
|
||||
|
||||
Reference in New Issue
Block a user