Files
pipelines/app/tool/graph_node_probe.dart
T
alan 13a5e1dee0 Remove Cupertino branches from probe fixtures
Keep the chat and graph fixtures aligned with the app's Material-only UI by removing alternate Cupertino hosts, imports, and query-controlled rendering paths. Preserve the existing Material scenarios and document the focused probe coverage.
2026-11-11 20:08:06 +00:00

83 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:pipelines_app/features/graph/domain/graph_definition.dart';
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
const _longKey = 'implementer-with-an-unshortened-stage-label';
const _oneXKey = 'narrow-one-x-stage-key-that-wraps';
/// Keys rendered in a 150 logical px box, with the text scale applied to them.
const _scaled = {_longKey: 2.0, _oneXKey: 1.0};
const _nodes = [
GraphNode(key: 'plan', terminal: false, stageIndex: 0),
GraphNode(key: 'build', terminal: false, stageIndex: 1),
GraphNode(key: _longKey, terminal: false, stageIndex: 2),
GraphNode(key: _oneXKey, terminal: false, stageIndex: 3),
GraphNode(key: '#success', terminal: true),
GraphNode(key: '#failure', terminal: true),
];
/// A fixture-only page: one measured node per definition identity, with the
/// selected key reported so a browser click can prove the exact callback.
class _Probe extends StatefulWidget {
const _Probe();
@override
State<_Probe> createState() => _ProbeState();
}
class _ProbeState extends State<_Probe> {
String? _selected = 'build';
Widget _node(GraphNode node) {
final child = GraphStageNode(
node: node,
recordedStatus: node.key == 'build' ? 'running' : null,
selected: node.key == _selected,
onSelected: (key) => setState(() => _selected = key),
);
final scale = _scaled[node.key];
if (scale == null) return child;
return MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: TextScaler.linear(scale)),
child: SizedBox(width: 150, child: child),
);
}
@override
Widget build(BuildContext context) {
final page = ListView(
padding: const EdgeInsets.all(16),
children: [
Text('Selected: ${_selected ?? 'none'}'),
const SizedBox(height: 12),
Wrap(
spacing: 12,
runSpacing: 12,
children: [for (final node in _nodes) _node(node)],
),
],
);
return Scaffold(body: SafeArea(child: page));
}
}
void main() {
runApp(
MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
// Stock dark theme so the forced `prefers-color-scheme` capture is
// a real dark render rather than a duplicate light one.
darkTheme: ThemeData(
platform: TargetPlatform.android,
brightness: Brightness.dark,
),
themeMode: ThemeMode.system,
home: const _Probe(),
),
);
}