feat(app): graphs draw stages in one row with Failure and Success below, as the web and TUI

This commit is contained in:
2026-10-23 16:02:15 +01:00
parent c12e1dc936
commit 15f83c19dd
5 changed files with 617 additions and 19 deletions
@@ -3,9 +3,8 @@ import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../domain/graph_definition.dart';
import '../layout/graph_node_layout.dart';
import '../layout/layout_models.dart';
import '../routing/graph_edge_routing.dart';
import '../layout/linear_graph_layout.dart';
import '../routing/route_models.dart';
import '../viewport/graph_expanded_view.dart';
import '../viewport/graph_viewport.dart';
@@ -103,17 +102,12 @@ class _DefinitionGraphViewState extends State<DefinitionGraphView> {
height: size.height,
);
}
final layout = layoutGraphNodes(
// The web's linear drawing: stages in one row, the ends below it.
final (layout, routing) = layoutLinearGraph(
nodes: nodes,
edges: edges,
extents: extents,
config: graphCanvasLayoutConfig(labelExtents.values),
);
final routing = routeGraphEdges(
layout: layout,
edges: edges,
labelExtents: labelExtents,
config: graphCanvasRoutingConfig(),
);
return (layout, routing);
}
@@ -80,7 +80,11 @@ class GraphStageNode extends StatelessWidget {
child: Padding(
padding: _contentPadding,
child: Align(
alignment: AlignmentDirectional.centerStart,
// A terminal box widens to give each incoming route its own port;
// its label stays centred in it.
alignment: node.terminal
? Alignment.center
: AlignmentDirectional.centerStart,
widthFactor: 1,
heightFactor: 1,
child: content,
@@ -4,9 +4,8 @@ import '../../../core/api_gateway.dart';
import '../domain/graph_definition.dart';
import '../domain/run_graph_state.dart';
import '../domain/stage_visits.dart';
import '../layout/graph_node_layout.dart';
import '../layout/layout_models.dart';
import '../routing/graph_edge_routing.dart';
import '../layout/linear_graph_layout.dart';
import '../routing/route_models.dart';
import '../viewport/graph_expanded_view.dart';
import '../viewport/graph_viewport.dart';
@@ -122,17 +121,12 @@ class _RunGraphViewState extends State<RunGraphView> {
height: size.height,
);
}
final layout = layoutGraphNodes(
// The web's linear drawing: stages in one row, the ends below it.
final (layout, routing) = layoutLinearGraph(
nodes: nodes,
edges: edges,
extents: extents,
config: graphCanvasLayoutConfig(labelExtents.values),
);
final routing = routeGraphEdges(
layout: layout,
edges: edges,
labelExtents: labelExtents,
config: graphCanvasRoutingConfig(),
);
return (layout, routing);
}