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),
);
}
}