Remove Cupertino UI branches

Keep the Material-only status, text, and scale paths while preserving public signatures and the Cupertino colors still required by the status API.
This commit is contained in:
2026-11-11 01:00:35 +00:00
parent c2b992542b
commit 3ca1bf4a00
5 changed files with 75 additions and 52 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ class UiScaleController extends ChangeNotifier {
/// Lays [child] out in a viewport [UiScaleController.scale] times smaller and
/// paints it scaled up to fill the window, so everything grows or shrinks
/// together. Use it as a `MaterialApp.builder`/`CupertinoApp.builder` child:
/// together. Use it as a `MaterialApp.builder` child:
/// the app's own MediaQuery is read from the window, so the scaled query has
/// to be provided below it. Hit testing follows the transform.
class UiScaleHost extends StatelessWidget {
+4 -12
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// Colours for recorded outcome names within one run.
@@ -40,21 +39,14 @@ class OutcomePalette {
/// Whether [outcome] was seen (and so has a colour of its own).
bool contains(String outcome) => _swatches.containsKey(_key(outcome));
/// [outcome]'s colour for the host's brightness; an unseen or blank name
/// uses the host's secondary text colour.
/// [outcome]'s colour for the theme's brightness; an unseen or blank name
/// uses the theme's secondary text colour.
Color colorFor(BuildContext context, String outcome) {
final cupertino =
context.findAncestorWidgetOfExactType<MaterialApp>() == null;
final brightness = cupertino
? CupertinoTheme.brightnessOf(context)
: Theme.of(context).brightness;
final swatch = _swatches[_key(outcome)];
if (swatch == null) {
return cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
: Theme.of(context).colorScheme.onSurfaceVariant;
return Theme.of(context).colorScheme.onSurfaceVariant;
}
return swatch.resolve(brightness);
return swatch.resolve(Theme.of(context).brightness);
}
/// [outcome]'s colour on a page of [brightness], or null when unseen.
+1 -19
View File
@@ -1,8 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../adaptive/host.dart';
/// The shared status glyph whose tooltip and accessible name say the state.
///
/// [state] is the normalised run state (`succeeded`, `failed`, `running`,
@@ -23,7 +21,6 @@ class RunStatusIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final color = runStatusColor(state).resolveFrom(context);
return Tooltip(
message: label,
@@ -31,11 +28,7 @@ class RunStatusIcon extends StatelessWidget {
label: label,
image: true,
excludeSemantics: true,
child: Icon(
cupertino ? _cupertinoIcon(state) : _materialIcon(state),
size: size,
color: color,
),
child: Icon(_materialIcon(state), size: size, color: color),
),
);
}
@@ -62,17 +55,6 @@ IconData _materialIcon(String state) => switch (state) {
_ => Icons.help_outline,
};
IconData _cupertinoIcon(String state) => switch (state) {
'succeeded' => CupertinoIcons.check_mark_circled,
'failed' => CupertinoIcons.xmark_circle,
'running' || 'active' => CupertinoIcons.arrow_2_circlepath,
'canceled' => CupertinoIcons.nosign,
'interrupted' => CupertinoIcons.pause_circle,
'waiting' => CupertinoIcons.person_crop_circle,
'queued' => CupertinoIcons.clock,
_ => CupertinoIcons.question_circle,
};
/// The run detail's kicker above its title, as the web's `run-kicker`: the
/// status glyph and the state word in the state's colour.
class RunStatusKicker extends StatelessWidget {
+10 -20
View File
@@ -1,8 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../features/chat/ui/transcript/chat_markdown_view.dart';
import '../adaptive/host.dart';
/// Authored markdown (a pipeline's source, a stage's prompt) shown rendered,
/// with a switch to the raw text.
@@ -51,23 +49,15 @@ class MarkdownModeSwitch extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
return cupertino
? CupertinoSlidingSegmentedControl<bool>(
key: const Key('markdown-source-mode'),
groupValue: raw,
onValueChanged: (value) => onChanged(value ?? false),
children: const {false: Text('Rendered'), true: Text('Raw')},
)
: SegmentedButton<bool>(
key: const Key('markdown-source-mode'),
showSelectedIcon: false,
segments: const [
ButtonSegment(value: false, label: Text('Rendered')),
ButtonSegment(value: true, label: Text('Raw')),
],
selected: {raw},
onSelectionChanged: (value) => onChanged(value.single),
);
return SegmentedButton<bool>(
key: const Key('markdown-source-mode'),
showSelectedIcon: false,
segments: const [
ButtonSegment(value: false, label: Text('Rendered')),
ButtonSegment(value: true, label: Text('Raw')),
],
selected: {raw},
onSelectionChanged: (value) => onChanged(value.single),
);
}
}
@@ -0,0 +1,59 @@
# Cupertino branches out of ui/status, ui/text and ui/scale
The app is Material-only, so the Cupertino sides of these shared widgets never
ran. Removed them; the Material path is unchanged.
## Changes
- `lib/ui/status/outcome_palette.dart`: `colorFor` always reads
`Theme.of(context)` (brightness and `onSurfaceVariant`) instead of choosing a
`CupertinoTheme`/`CupertinoColors.secondaryLabel` branch when there is no
`MaterialApp` ancestor. Dropped the `flutter/cupertino.dart` import.
- `lib/ui/status/run_status_icon.dart`: `RunStatusIcon` always draws
`_materialIcon`; removed `usesCupertinoHost`, `_cupertinoIcon` and the
`ui/adaptive/host.dart` import.
- `lib/ui/text/markdown_source_view.dart`: `MarkdownModeSwitch` always uses the
Material `SegmentedButton`; removed the `CupertinoSlidingSegmentedControl`
branch, the `cupertino.dart` import and the host helper import.
- `lib/ui/scale/ui_scale.dart`: the `UiScaleHost` doc comment names only
`MaterialApp.builder`.
No public constructor or signature changed (`runStatusColor`, `RunStatusIcon`,
`RunStatusKicker`, `MarkdownSourceView`, `MarkdownModeSwitch`, `OutcomePalette`,
`UiScaleHost` stay as they were), so callers in other directories still compile.
## Cupertino that stays (Material path uses it)
- `runStatusColor` returns `CupertinoDynamicColor` and uses `CupertinoColors`
(`systemGreen`, `systemRed`, `systemBlue`, `systemYellow`, `systemOrange`,
`systemGrey`). Every caller outside these directories calls
`.resolveFrom(context)`, so the return type and the colour values must stay
until the later run that removes the remaining Cupertino code.
No `CupertinoIcons` or `Cupertino` widgets remain under the three directories.
## Checks
- `tool/memwatch/full.sh 'test/ui/status test/ui/text test/ui/scale '`:
PASS, 19 passed, 0 failed, 0 skipped.
- Cross-directory users of the edited widgets:
`test/features/runs/ui/run_timeline_row_test.dart`,
`test/features/runs/ui/runs_list_widget_test.dart`,
`test/features/runs/ui/run_cancel_wiring_test.dart`,
`test/features/runs/ui/run_list_row_test.dart`,
`test/features/attention/ui/needs_you_sheet_test.dart`,
`test/features/graph/domain/run_graph_order_test.dart`: PASS, 31 passed,
0 failed, 0 skipped.
- `tool/analyze.sh`: clean, exit 0 (31s).
- `dart format` on the four edited files: 0 changed.
No Cupertino test variant in the matching test directories existed to delete.
The cross-directory `for (final cupertino in [false, true])` loops host other
lanes' still-live Cupertino branches (`AppListRow`, `RunsList`, `NeedsYouPage`,
cancel dialogs); none asserts Cupertino-specific behaviour of the edited
widgets, so they were kept and pass on both hosts.
Affected UI states: run status glyphs and kicker (light/dark), outcome chips in
the run timeline, the run detail's kicker, the Rendered | Raw markdown switch,
and the UI-scale host. Material rendering is unchanged; ui-review captures
`/runs` in light and dark.