Merge commit '148b3e790560f14d97c6ebfee69b0bf578c9d11d' into pipelines/run-20261111-0216-cupertino-out-templates-29f5

This commit is contained in:
2026-11-11 03:06:11 +00:00
22 changed files with 536 additions and 698 deletions
@@ -1,8 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import 'graph_viewport.dart';
import 'graph_viewport_controller.dart';
@@ -100,23 +98,6 @@ class _GraphExpandedViewState extends State<GraphExpandedView> {
Expanded(child: viewport),
],
);
if (usesCupertinoHost(context)) {
return CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
automaticallyImplyLeading: false,
leading: SegmentedBackButton(cupertino: true, onPressed: _close),
title: widget.title,
actions: [
_GraphFitButton(
cupertino: true,
onPressed: _controller.fitToViewport,
),
],
),
child: BelowTopBar(child: body),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
@@ -124,12 +105,7 @@ class _GraphExpandedViewState extends State<GraphExpandedView> {
title: widget.title,
automaticallyImplyLeading: false,
leading: SegmentedBackButton(cupertino: false, onPressed: _close),
actions: [
_GraphFitButton(
cupertino: false,
onPressed: _controller.fitToViewport,
),
],
actions: [_GraphFitButton(onPressed: _controller.fitToViewport)],
),
body: BelowTopBar(child: body),
);
@@ -137,9 +113,8 @@ class _GraphExpandedViewState extends State<GraphExpandedView> {
}
class _GraphFitButton extends StatelessWidget {
const _GraphFitButton({required this.cupertino, required this.onPressed});
const _GraphFitButton({required this.onPressed});
final bool cupertino;
final VoidCallback onPressed;
@override
@@ -147,22 +122,15 @@ class _GraphFitButton extends StatelessWidget {
child: Semantics(
button: true,
label: graphFitLabel,
child: cupertino
? CupertinoButton(
key: const Key('graph-fit'),
padding: const EdgeInsets.all(8),
onPressed: onPressed,
child: const ExcludeSemantics(child: Icon(CupertinoIcons.resize)),
)
: Tooltip(
message: graphFitLabel,
excludeFromSemantics: true,
child: IconButton(
key: const Key('graph-fit'),
onPressed: onPressed,
icon: const ExcludeSemantics(child: Icon(Icons.fit_screen)),
),
),
child: Tooltip(
message: graphFitLabel,
excludeFromSemantics: true,
child: IconButton(
key: const Key('graph-fit'),
onPressed: onPressed,
icon: const ExcludeSemantics(child: Icon(Icons.fit_screen)),
),
),
),
);
}
@@ -190,8 +158,9 @@ Future<void> openGraphExpanded(
selectedStage: selectedStage,
header: header,
);
final route = usesCupertinoHost(context)
? CupertinoPageRoute<void>(fullscreenDialog: true, builder: (_) => page)
: MaterialPageRoute<void>(fullscreenDialog: true, builder: (_) => page);
final route = MaterialPageRoute<void>(
fullscreenDialog: true,
builder: (_) => page,
);
return Navigator.of(context).push(route);
}
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/glass_pill.dart';
import 'graph_viewport_controller.dart';
@@ -121,20 +119,20 @@ class _GraphViewportState extends State<GraphViewport> {
top: 8,
end: 8,
child: GlassPill(
cupertino: usesCupertinoHost(context),
cupertino: false,
child: Wrap(
spacing: 2,
children: [
_ViewportButton(
buttonKey: const Key('graph-fit'),
icon: _fitIcon(context),
icon: Icons.fit_screen,
label: graphFitLabel,
onPressed: widget.controller.fitToViewport,
),
if (widget.onExpand != null)
_ViewportButton(
buttonKey: const Key('graph-expand'),
icon: _expandIcon(context),
icon: Icons.fullscreen,
label: graphExpandLabel,
onPressed: widget.onExpand,
),
@@ -147,12 +145,6 @@ class _GraphViewportState extends State<GraphViewport> {
},
);
}
IconData _fitIcon(BuildContext context) =>
usesCupertinoHost(context) ? CupertinoIcons.resize : Icons.fit_screen;
IconData _expandIcon(BuildContext context) =>
usesCupertinoHost(context) ? CupertinoIcons.fullscreen : Icons.fullscreen;
}
/// One native graph control inside the shared floating glass pill.
@@ -160,7 +152,7 @@ class _GraphViewportState extends State<GraphViewport> {
/// The label and the button's own tap action must reach the same semantics
/// node: the icon is the only excluded child, and [MergeSemantics] folds the
/// host button's action into the labelled node, so a screen reader can activate
/// Fit and Expand on either host. A hand-written `Semantics` sibling around an
/// Fit and Expand. A hand-written `Semantics` sibling around an
/// excluded button would announce the control with no action at all.
class _ViewportButton extends StatelessWidget {
const _ViewportButton({
@@ -181,24 +173,17 @@ class _ViewportButton extends StatelessWidget {
child: Semantics(
button: true,
label: label,
child: usesCupertinoHost(context)
? CupertinoButton(
key: buttonKey,
padding: const EdgeInsets.all(8),
onPressed: onPressed,
child: ExcludeSemantics(child: Icon(icon)),
)
: Tooltip(
message: label,
// The merged node already carries the label; the tooltip is
// only the pointer affordance.
excludeFromSemantics: true,
child: IconButton(
key: buttonKey,
onPressed: onPressed,
icon: ExcludeSemantics(child: Icon(icon)),
),
),
child: Tooltip(
message: label,
// The merged node already carries the label; the tooltip is
// only the pointer affordance.
excludeFromSemantics: true,
child: IconButton(
key: buttonKey,
onPressed: onPressed,
icon: ExcludeSemantics(child: Icon(icon)),
),
),
),
);
}
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../layout/layout_models.dart';
import '../routing/route_models.dart';
@@ -32,9 +30,9 @@ RoutingConfig graphCanvasRoutingConfig() => RoutingConfig(
/// The native theme roles one definition graph canvas needs.
///
/// No palette, font family or size is defined here: every value comes from the
/// ambient Material or Cupertino theme, so light/dark and text scaling follow
/// the host exactly. Edge labels and diagnostics are metadata, so they use the
/// host's secondary-label role rather than the node's own label style.
/// ambient Material theme, so light/dark and text scaling follow the host
/// exactly. Edge labels and diagnostics are metadata, so they use the host's
/// secondary-label role rather than the node's own label style.
class GraphCanvasStyle {
const GraphCanvasStyle({
required this.labelStyle,
@@ -44,20 +42,6 @@ class GraphCanvasStyle {
});
factory GraphCanvasStyle.of(BuildContext context) {
if (usesCupertinoHost(context)) {
final theme = CupertinoTheme.of(context);
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
return GraphCanvasStyle(
labelStyle: theme.textTheme.tabLabelTextStyle.copyWith(
color: secondary,
),
messageStyle: theme.textTheme.textStyle.copyWith(color: secondary),
edgeColor: CupertinoColors.separator.resolveFrom(context),
// Cupertino has no divider-thickness token; its separators are one
// logical pixel hairlines, so the stroke keeps that native default.
edgeWidth: 1,
);
}
final theme = Theme.of(context);
final secondary = theme.colorScheme.onSurfaceVariant;
return GraphCanvasStyle(
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/status/run_status_icon.dart';
import '../domain/graph_definition.dart';
@@ -37,7 +35,7 @@ class GraphStageNode extends StatelessWidget {
/// Reports [node.key] exactly as the definition recorded it.
final ValueChanged<String> onSelected;
/// Content inset shared by both hosts. It is spacing, not a size: the control
/// Content inset for a graph node. It is spacing, not a size: the control
/// still takes its size from its label, and the inset keeps wrapped glyphs
/// clear of a rounded surface's corners.
static const EdgeInsets _contentPadding = EdgeInsets.all(16);
@@ -61,9 +59,7 @@ class GraphStageNode extends StatelessWidget {
button: true,
selected: selected,
label: _label,
child: usesCupertinoHost(context)
? _cupertinoButton(onPressed, content)
: _materialCard(onPressed, content),
child: _materialCard(onPressed, content),
),
);
return active ? StageActivityHalo(child: control) : control;
@@ -106,12 +102,6 @@ class GraphStageNode extends StatelessWidget {
);
}
/// Tinted is Cupertino's stock low-emphasis surface, so an unselected node is
/// still a visible node body; filled raises the selected one.
Widget _cupertinoButton(VoidCallback onPressed, Widget content) => selected
? CupertinoButton.filled(onPressed: onPressed, child: content)
: CupertinoButton.tinted(onPressed: onPressed, child: content);
Widget _content(BuildContext context) {
final status = _status;
// The recorded status reads apart from the name: a coloured dot and
@@ -215,10 +205,7 @@ class _StageActivityHaloState extends State<StageActivityHalo>
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final color = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary;
final color = Theme.of(context).colorScheme.primary;
return AnimatedBuilder(
animation: _controller,
builder: (context, child) => CustomPaint(
@@ -1,8 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart' show listEquals;
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../domain/graph_definition.dart';
import '../domain/run_graph_state.dart';
import '../layout/layout_models.dart';
@@ -200,10 +198,7 @@ class RunGraphCanvas extends StatelessWidget {
final executedIds = {for (final route in executed) route.id};
final size = Size(routing.width, routing.height);
final activeStage = state.activeStage;
final cupertino = usesCupertinoHost(context);
final executedColor = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary;
final executedColor = Theme.of(context).colorScheme.primary;
return Stack(
clipBehavior: Clip.none,
children: [
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import '../domain/run_graph_state.dart';
import 'graph_canvas_style.dart';
@@ -31,10 +29,7 @@ class RunGraphHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final executedColor = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary;
final executedColor = Theme.of(context).colorScheme.primary;
final mutedColor = style.edgeColor;
final active = state.activeStage;
return Padding(
@@ -53,14 +48,12 @@ class RunGraphHeader extends StatelessWidget {
crossAxisAlignment: WrapCrossAlignment.center,
children: [
_LegendEntry(
icon: cupertino
? CupertinoIcons.arrow_right
: Icons.arrow_forward,
icon: Icons.arrow_forward,
label: runGraphExecuted,
color: executedColor,
),
_LegendEntry(
icon: cupertino ? CupertinoIcons.minus : Icons.remove,
icon: Icons.remove,
label: runGraphNotExecuted,
color: mutedColor,
),
@@ -1,14 +1,12 @@
import '../../../ui/adaptive/segmented_bar.dart';
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/text/markdown_source_view.dart';
import '../../chat/ui/transcript/chat_markdown_view.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/host.dart';
import '../domain/graph_protocol.dart';
import '../domain/stage_definition.dart';
@@ -159,30 +157,14 @@ Future<void> openStageDefinition(
// A terminal is a definition target, not its protocol key: the web pane
// titles it with `nodeDisplayLabel` (`Failure`/`Success`).
final title = '${nodeDisplayLabel(stageKey)} definition';
final route = usesCupertinoHost(context)
? CupertinoPageRoute<void>(
settings: settings,
builder: (_) => CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
title: title,
subtitle: identity,
),
child: SafeArea(top: false, bottom: false, child: view),
),
)
: MaterialPageRoute<void>(
settings: settings,
builder: (_) => Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
cupertino: false,
title: title,
subtitle: identity,
),
body: SafeArea(top: false, bottom: false, child: view),
),
);
final route = MaterialPageRoute<void>(
settings: settings,
builder: (_) => Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: title, subtitle: identity),
body: SafeArea(top: false, bottom: false, child: view),
),
);
return Navigator.of(context).push(route);
}
@@ -263,22 +245,6 @@ class _StageDefinitionStyle {
});
factory _StageDefinitionStyle.of(BuildContext context) {
if (usesCupertinoHost(context)) {
final theme = CupertinoTheme.of(context);
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
return _StageDefinitionStyle(
label: theme.textTheme.tabLabelTextStyle.copyWith(color: secondary),
// SelectableText needs a style it can merge into the default text
// style; Cupertino's textStyle is a complete style with `inherit: false`
// and no baseline.
value: theme.textTheme.textStyle.copyWith(inherit: true),
muted: theme.textTheme.textStyle.copyWith(
inherit: true,
color: secondary,
),
heading: theme.textTheme.navTitleTextStyle,
);
}
final theme = Theme.of(context);
return _StageDefinitionStyle(
label: (theme.textTheme.labelMedium ?? const TextStyle()).copyWith(