Files
pipelines/app/tool/graph_canvas_probe.dart
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

107 lines
3.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/graph/widgets/definition_graph_view.dart';
const String _longKey = 'implementer-with-an-unusually-long-stage-label';
/// A definition with forward, fallback, self-loop and terminal edges so one
/// canvas shows measured wrapping nodes, native outcome labels and arrows.
JsonMap _definition() => <String, dynamic>{
'stages': <dynamic>[
<String, dynamic>{
'key': 'plan',
'type': 'model',
'edges': <String, String?>{'success': 'build', 'error': '#'},
'fallback_error': true,
},
<String, dynamic>{
'key': 'build',
'type': 'model',
'edges': <String, String?>{'success': _longKey, 'retry': 'build'},
},
<String, dynamic>{
'key': _longKey,
'type': 'model',
'edges': <String, String?>{'success': 'audit', 'blocked': '#failure'},
},
<String, dynamic>{
'key': 'audit',
'type': 'model',
'edges': <String, String?>{'success': '#success', 'error': '#failure'},
},
],
};
/// Isolated browser fixture for `DefinitionGraphView` only.
///
/// Not wired into the app or shell. `scale=2` applies a real 2x text scale to the graph viewport,
/// and a click reports the exact stage key in the status line.
void main() {
final parameters = Uri.base.queryParameters;
final scale = double.tryParse(parameters['scale'] ?? '') ?? 1;
runApp(_ProbeApp(scale: scale));
}
class _ProbeApp extends StatelessWidget {
const _ProbeApp({required this.scale});
final double scale;
@override
Widget build(BuildContext context) {
final page = _ProbePage(scale: scale);
return MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
darkTheme: ThemeData(
platform: TargetPlatform.android,
brightness: Brightness.dark,
),
themeMode: ThemeMode.system,
home: Scaffold(
appBar: AppBar(title: const Text('Definition graph')),
body: SafeArea(child: page),
),
);
}
}
class _ProbePage extends StatefulWidget {
const _ProbePage({required this.scale});
final double scale;
@override
State<_ProbePage> createState() => _ProbePageState();
}
class _ProbePageState extends State<_ProbePage> {
String? _selected = 'build';
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Selected: ${_selected ?? 'none'}'),
const SizedBox(height: 8),
Expanded(
child: MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: TextScaler.linear(widget.scale)),
child: DefinitionGraphView(
graph: _definition(),
selectedStage: _selected,
onSelected: (key) => setState(() => _selected = key),
),
),
),
],
),
);
}
}