Files
pipelines/app/lib/features/runs/ui/run_graph_preview.dart
T
alan fde086cc4a feat(app): glass viewer bars, graph controls and immersive image viewer
Review findings F12, F13, F25 and F1 for viewers: the artifact viewer's
actions/pager and the Changes pager float as glass pills over content,
file facts move to the top bar, graph overlay controls are one glass pill
(duplicate fullscreen glyph removed), the image viewer is immersive, and
diff/artifact/graph views let content pass behind the bar. Implemented by
pipeline run #204 (Terra); its Review stopped after three rejections, the
last being an empty glass bar for a single unresolved artifact, which the
manager fixed here with a regression test.
2026-10-31 04:26:22 +00:00

116 lines
3.7 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../graph/widgets/run_graph_view.dart';
const runGraphPreviewKey = ValueKey<String>('run-graph-preview');
/// 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) {
final cupertino = usesCupertinoHost(context);
final border = cupertino
? CupertinoColors.separator.resolveFrom(context)
: 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, cupertino),
child: GestureDetector(
key: runGraphPreviewKey,
behavior: HitTestBehavior.opaque,
onTap: () => _open(context, cupertino),
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, bool cupertino) {
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>(
cupertino
? CupertinoPageRoute<void>(
builder: (page) => CupertinoPageScaffold(
navigationBar: const SegmentedBar(
cupertino: true,
title: 'Graph',
),
child: BelowTopBar(child: graphView(page)),
),
)
: MaterialPageRoute<void>(
builder: (page) => Scaffold(
extendBodyBehindAppBar: true,
appBar: const SegmentedBar(cupertino: false, title: 'Graph'),
body: BelowTopBar(child: graphView(page)),
),
),
);
}
}