9551eceaed
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
118 lines
3.8 KiB
Dart
118 lines
3.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../ui/adaptive/segmented_bar.dart';
|
|
import '../../../core/api_gateway.dart';
|
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
|
import '../../graph/domain/graph_definition.dart';
|
|
import '../../graph/widgets/run_graph_view.dart';
|
|
|
|
const runGraphPreviewKey = ValueKey<String>('run-graph-preview');
|
|
|
|
/// The muted line shown in place of the preview when the run has no graph.
|
|
const runGraphPreviewMissingKey = ValueKey<String>('run-graph-preview-missing');
|
|
|
|
/// The run graph as a still picture on top of Summary. Tapping it opens the
|
|
/// interactive graph full screen; picking a stage there closes it and hands
|
|
/// the stage to [onStageSelected].
|
|
class RunGraphPreview extends StatelessWidget {
|
|
const RunGraphPreview({
|
|
super.key,
|
|
required this.graph,
|
|
required this.run,
|
|
required this.onStageSelected,
|
|
this.selectedStage,
|
|
this.height = 200,
|
|
});
|
|
|
|
final JsonMap? graph;
|
|
final JsonMap run;
|
|
final ValueChanged<String> onStageSelected;
|
|
final String? selectedStage;
|
|
final double height;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// No graph to draw: one muted line, with no frame and nothing to open.
|
|
if (graphNodes(graph).isEmpty) {
|
|
return Padding(
|
|
key: runGraphPreviewMissingKey,
|
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
|
child: Text(
|
|
runGraphMissing,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
final border = Theme.of(context).colorScheme.outlineVariant;
|
|
return Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
|
child: Semantics(
|
|
button: true,
|
|
label: 'Run graph, open full screen',
|
|
excludeSemantics: true,
|
|
onTap: () => _open(context),
|
|
child: GestureDetector(
|
|
key: runGraphPreviewKey,
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: () => _open(context),
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: border),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: SizedBox(
|
|
height: height,
|
|
child: Stack(
|
|
children: [
|
|
Positioned.fill(
|
|
// A picture, not a control: the full-screen view is
|
|
// where the graph pans, zooms and opens stages.
|
|
child: IgnorePointer(
|
|
child: RunGraphView(
|
|
graph: graph,
|
|
run: run,
|
|
selectedStage: selectedStage,
|
|
onStageSelected: (_) {},
|
|
showHeader: false,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Future<void> _open(BuildContext context) {
|
|
Widget graphView(BuildContext pageContext) => RunGraphView(
|
|
key: const Key('run-detail-graph'),
|
|
// Already full screen: no maximise button to open it again.
|
|
expandable: false,
|
|
graph: graph,
|
|
run: run,
|
|
selectedStage: selectedStage,
|
|
onStageSelected: (stage) {
|
|
Navigator.of(pageContext).pop();
|
|
onStageSelected(stage);
|
|
},
|
|
);
|
|
return Navigator.of(context).push<void>(
|
|
MaterialPageRoute<void>(
|
|
builder: (page) => Scaffold(
|
|
extendBodyBehindAppBar: true,
|
|
appBar: const SegmentedBar(title: 'Graph'),
|
|
body: BelowTopBar(child: graphView(page)),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|