Remove Cupertino UI branches from shared primitives
Keep the existing Material rendering, semantics, and interaction paths while removing obsolete Cupertino imports, alternate widgets, and dynamic-color dependencies. Record focused verification and remaining fixture limitations for final integration.
This commit is contained in:
@@ -108,7 +108,7 @@ class GraphStageNode extends StatelessWidget {
|
||||
// coloured, smaller text in the status's own hue.
|
||||
final color = status == null
|
||||
? null
|
||||
: runStatusColor(graphStatusState(status)).resolveFrom(context);
|
||||
: runStatusColor(graphStatusState(status), Theme.of(context).colorScheme);
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -238,7 +238,7 @@ class PipelineListPanel extends StatelessWidget {
|
||||
? null
|
||||
: AppListStatusDot(
|
||||
key: Key('pipeline-status-${pipeline.id}'),
|
||||
color: runStatusColor(badge.state).resolveFrom(context),
|
||||
color: runStatusColor(badge.state, Theme.of(context).colorScheme),
|
||||
semanticLabel: runStateLabel(badge.state),
|
||||
),
|
||||
subtitle: Text(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/layout/app_list_avatar.dart';
|
||||
@@ -116,7 +116,7 @@ class RunTimelineRow extends StatelessWidget {
|
||||
context,
|
||||
visit.outcome,
|
||||
)
|
||||
: runStatusColor(_state).resolveFrom(context);
|
||||
: runStatusColor(_state, Theme.of(context).colorScheme);
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
@@ -145,7 +145,7 @@ class RunTimelineRow extends StatelessWidget {
|
||||
divider: divider,
|
||||
onTap: onTap,
|
||||
leading: AppListAvatar(
|
||||
foreground: runStatusColor(state).resolveFrom(context),
|
||||
foreground: runStatusColor(state, Theme.of(context).colorScheme),
|
||||
child: RunStatusIcon(
|
||||
state: state,
|
||||
label: visit.status.isEmpty ? 'Status unavailable' : visit.status,
|
||||
|
||||
@@ -94,7 +94,7 @@ class _FactGrid extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _pill(BuildContext context, VisitFact fact) {
|
||||
final color = runStatusColor(_stateOf(fact)).resolveFrom(context);
|
||||
final color = runStatusColor(_stateOf(fact), Theme.of(context).colorScheme);
|
||||
return DecoratedBox(
|
||||
decoration: ShapeDecoration(
|
||||
color: color.withValues(alpha: 0.16),
|
||||
|
||||
@@ -126,7 +126,7 @@ class RunListRow extends StatelessWidget {
|
||||
onLongPress: selecting ? null : onLongPress,
|
||||
selectionControl: selecting ? _checkbox(context) : null,
|
||||
leading: AppListAvatar(
|
||||
foreground: runStatusColor(state).resolveFrom(context),
|
||||
foreground: runStatusColor(state, Theme.of(context).colorScheme),
|
||||
child: RunStatusIcon(state: state, label: runStatusLabel(run)),
|
||||
),
|
||||
title: Text(title),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
@@ -54,12 +54,12 @@ class RunPathMini extends StatelessWidget {
|
||||
final stages = path.stages.length > maxStages
|
||||
? path.stages.sublist(path.stages.length - maxStages)
|
||||
: path.stages;
|
||||
final line = CupertinoColors.separator.resolveFrom(context);
|
||||
final line = Theme.of(context).colorScheme.outlineVariant;
|
||||
Widget box(RunPathStage stage) => Container(
|
||||
width: 14,
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: runStatusColor(stage.state).resolveFrom(context),
|
||||
color: runStatusColor(stage.state, Theme.of(context).colorScheme),
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
);
|
||||
@@ -83,7 +83,8 @@ class RunPathMini extends StatelessWidget {
|
||||
shape: BoxShape.circle,
|
||||
color: runStatusColor(
|
||||
end == '#success' ? 'succeeded' : 'failed',
|
||||
).resolveFrom(context),
|
||||
Theme.of(context).colorScheme,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -92,7 +92,7 @@ class RunsStatsPage extends StatelessWidget {
|
||||
painter: _PiePainter([
|
||||
for (final entry in byState.entries)
|
||||
(
|
||||
runStatusColor(entry.key).resolveFrom(context),
|
||||
runStatusColor(entry.key, Theme.of(context).colorScheme),
|
||||
entry.value,
|
||||
),
|
||||
]),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:ui' show SemanticsRole;
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Content-driven main navigation captions keep names visible without scaling
|
||||
@@ -21,12 +20,8 @@ class FloatingDestinationLabels extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = cupertino
|
||||
? CupertinoColors.label.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurface;
|
||||
final style = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle
|
||||
: Theme.of(context).textTheme.labelSmall!;
|
||||
final color = Theme.of(context).colorScheme.onSurface;
|
||||
final style = Theme.of(context).textTheme.labelSmall!;
|
||||
return Semantics(
|
||||
role: SemanticsRole.tabBar,
|
||||
container: true,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:ui' show SemanticsRole;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -73,40 +72,24 @@ class FloatingTabButton extends StatelessWidget {
|
||||
role: SemanticsRole.tab,
|
||||
selected: selected,
|
||||
button: true,
|
||||
label: cupertino || kIsWeb ? label : '$label\n${_tabLabel(context)}',
|
||||
hint: cupertino ? _tabLabel(context) : null,
|
||||
label: kIsWeb ? label : '$label\n${_tabLabel(context)}',
|
||||
// Switching tabs does not unfocus a text field (the composer).
|
||||
child: TextFieldTapRegion(
|
||||
child: cupertino
|
||||
? button
|
||||
: Tooltip(
|
||||
message: label,
|
||||
excludeFromSemantics: true,
|
||||
child: button,
|
||||
),
|
||||
child: Tooltip(
|
||||
message: label,
|
||||
excludeFromSemantics: true,
|
||||
child: button,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _tabLabel(BuildContext context) => cupertino
|
||||
? CupertinoLocalizations.of(
|
||||
context,
|
||||
).tabSemanticsLabel(tabIndex: index + 1, tabCount: count)
|
||||
: MaterialLocalizations.of(
|
||||
String _tabLabel(BuildContext context) => MaterialLocalizations.of(
|
||||
context,
|
||||
).tabLabel(tabIndex: index + 1, tabCount: count);
|
||||
|
||||
({Color tint, Color selectedIcon, Color icon}) _colors(BuildContext context) {
|
||||
if (cupertino) {
|
||||
final active = CupertinoTheme.of(context).primaryColor;
|
||||
return (
|
||||
tint: active.withValues(alpha: cupertinoTintOpacity),
|
||||
selectedIcon: active,
|
||||
// Secondary-label translucency over glass falls below contrast.
|
||||
icon: CupertinoColors.label.resolveFrom(context),
|
||||
);
|
||||
}
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return (
|
||||
tint: scheme.secondaryContainer,
|
||||
@@ -125,21 +108,7 @@ class FloatingTabButton extends StatelessWidget {
|
||||
color: colors.tint.withValues(alpha: colors.tint.a * t),
|
||||
shape: const CircleBorder(),
|
||||
);
|
||||
final Widget fill = cupertino
|
||||
? DecoratedBox(
|
||||
key: fillKey,
|
||||
decoration: decoration,
|
||||
child: MouseRegion(
|
||||
cursor: kIsWeb ? SystemMouseCursors.click : MouseCursor.defer,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onTap,
|
||||
),
|
||||
),
|
||||
)
|
||||
// Painted on the glass's Material, under the ink, so the ripple
|
||||
// shows over the selected tint too.
|
||||
: Ink(
|
||||
final Widget fill = Ink(
|
||||
key: fillKey,
|
||||
decoration: decoration,
|
||||
child: InkResponse(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'glass_pill.dart';
|
||||
@@ -20,11 +19,10 @@ abstract final class GlassBarMetrics {
|
||||
static const double fieldEdgeGap = 4;
|
||||
|
||||
/// The square target of one control: the platform's minimum touch target.
|
||||
static double controlExtent(bool cupertino) =>
|
||||
cupertino ? kMinInteractiveDimensionCupertino : kMinInteractiveDimension;
|
||||
static double controlExtent(bool cupertino) => kMinInteractiveDimension;
|
||||
|
||||
/// The icon drawn inside a control's target.
|
||||
static double iconSize(bool cupertino) => cupertino ? 30 : 28;
|
||||
static double iconSize(bool cupertino) => 28;
|
||||
|
||||
/// The space between a control's icon and the edge of its target.
|
||||
static double iconInset(bool cupertino) =>
|
||||
@@ -44,8 +42,8 @@ abstract final class GlassBarMetrics {
|
||||
minHeight: controlExtent(false),
|
||||
);
|
||||
|
||||
/// The Cupertino minimum size of one control.
|
||||
static Size cupertinoMinimumSize() => Size.square(controlExtent(true));
|
||||
/// Compatibility helper for callers still passing the old control family.
|
||||
static Size cupertinoMinimumSize() => Size.square(controlExtent(false));
|
||||
}
|
||||
|
||||
/// A [GlassPill] padded by [GlassBarMetrics.edgeGap] on every side around
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'glass_surface.dart';
|
||||
@@ -68,16 +67,9 @@ class GlassPill extends StatelessWidget {
|
||||
final textDirection = Directionality.maybeOf(context);
|
||||
final Color base;
|
||||
final Color edge;
|
||||
if (cupertino) {
|
||||
// Grey 5 stays visibly raised over both the black dark canvas and the
|
||||
// white light canvas; Grey 6 disappears into either one when blurred.
|
||||
base = CupertinoColors.systemGrey5.resolveFrom(context);
|
||||
edge = CupertinoColors.separator.resolveFrom(context);
|
||||
} else {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
base = scheme.surfaceContainerHigh;
|
||||
edge = scheme.outlineVariant;
|
||||
}
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
base = scheme.surfaceContainerHigh;
|
||||
edge = scheme.outlineVariant;
|
||||
final opaque = fill ?? (solid ? base : base.withValues(alpha: fillOpacity));
|
||||
final color = opaque.withValues(alpha: opaque.a * reveal);
|
||||
final look = GlassLook.forFill(opaque);
|
||||
@@ -86,9 +78,7 @@ class GlassPill extends StatelessWidget {
|
||||
final border = shape.copyWith(
|
||||
side: BorderSide(color: faded(edge, solid ? 1 : 0.6), width: 0.5),
|
||||
);
|
||||
Widget content = cupertino
|
||||
? child
|
||||
: Material(type: MaterialType.transparency, child: child);
|
||||
Widget content = Material(type: MaterialType.transparency, child: child);
|
||||
if (!solid) {
|
||||
// The highlight lies on the fill under the content; the rim is drawn
|
||||
// over the content (and its ink) so the edge stays clean.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'host.dart';
|
||||
|
||||
/// A native-themed affordance for a draggable pane divider.
|
||||
class AdaptiveResizeGrip extends StatelessWidget {
|
||||
const AdaptiveResizeGrip({
|
||||
@@ -18,31 +15,24 @@ class AdaptiveResizeGrip extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return RotatedBox(
|
||||
quarterTurns: axis == Axis.vertical ? 1 : 0,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondarySystemBackground.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: emphasized
|
||||
? Border.all(
|
||||
color: cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: compact ? 6 : 8),
|
||||
child: Icon(
|
||||
cupertino ? CupertinoIcons.minus : Icons.drag_handle,
|
||||
Icons.drag_handle,
|
||||
size: compact ? 12 : 18,
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/physics.dart';
|
||||
|
||||
@@ -104,9 +103,7 @@ class _SegmentedPressState extends State<SegmentedPress>
|
||||
|
||||
Color _tint(BuildContext context) {
|
||||
if (widget.tint case final tint?) return tint;
|
||||
return widget.cupertino
|
||||
? CupertinoColors.label.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurface;
|
||||
return Theme.of(context).colorScheme.onSurface;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'app_menu_anchor.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// The key of a [SegmentedBar]'s More button, shown when its actions do not
|
||||
@@ -85,20 +84,6 @@ class SegmentedMoreButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (cupertino) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
excludeSemantics: true,
|
||||
child: CupertinoButton(
|
||||
key: segmentedMoreKey,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
|
||||
onPressed: () => _showSheet(context),
|
||||
child: const Icon(CupertinoIcons.ellipsis),
|
||||
),
|
||||
);
|
||||
}
|
||||
return AppMenuAnchor(
|
||||
menuChildren: [
|
||||
for (final entry in entries)
|
||||
@@ -138,45 +123,4 @@ class SegmentedMoreButton extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showSheet(BuildContext context) async {
|
||||
final picked = await _sheet<SegmentedOverflowEntry>(context, [
|
||||
for (final entry in entries)
|
||||
if (entry.onPressed != null || entry.choices.isNotEmpty)
|
||||
(entry.label, false, entry),
|
||||
]);
|
||||
if (picked == null || !context.mounted) return;
|
||||
if (picked.choices.isEmpty) {
|
||||
picked.onPressed?.call();
|
||||
return;
|
||||
}
|
||||
final choice = await _sheet<SegmentedMenuChoice>(context, [
|
||||
for (final choice in picked.choices)
|
||||
(choice.label, choice.selected, choice),
|
||||
], title: picked.label);
|
||||
choice?.onSelected();
|
||||
}
|
||||
|
||||
Future<T?> _sheet<T>(
|
||||
BuildContext context,
|
||||
List<(String, bool, T)> items, {
|
||||
String? title,
|
||||
}) => showCupertinoModalPopup<T>(
|
||||
context: context,
|
||||
builder: (sheet) => CupertinoActionSheet(
|
||||
title: title == null ? null : Text(title),
|
||||
actions: [
|
||||
for (final (label, selected, value) in items)
|
||||
CupertinoActionSheetAction(
|
||||
// The current choice is the sheet's default (bold) action.
|
||||
isDefaultAction: selected,
|
||||
onPressed: () => Navigator.of(sheet).pop(value),
|
||||
child: Semantics(selected: selected, child: Text(label)),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
onPressed: () => Navigator.of(sheet).pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'glass_pill.dart';
|
||||
@@ -7,7 +6,7 @@ import 'segmented_bar_motion.dart';
|
||||
/// The smallest height of every piece of a [SegmentedBar]: the platform's
|
||||
/// minimum touch target, so a round Back is a circle.
|
||||
double segmentedPieceHeight(bool cupertino) =>
|
||||
cupertino ? kMinInteractiveDimensionCupertino : kMinInteractiveDimension;
|
||||
kMinInteractiveDimension;
|
||||
|
||||
/// One rounded piece of a segmented bar: a [GlassPill] at least the
|
||||
/// platform's touch-target size.
|
||||
@@ -42,8 +41,7 @@ class SegmentedPill extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// The platform's own Back for a segmented bar: Material [BackButton],
|
||||
/// Cupertino [CupertinoNavigationBarBackButton]. A null [onPressed] keeps the
|
||||
/// The app's Material Back button for a segmented bar. A null [onPressed] keeps the
|
||||
/// stock action (pop the route).
|
||||
class SegmentedBackButton extends StatelessWidget {
|
||||
const SegmentedBackButton({
|
||||
@@ -56,9 +54,7 @@ class SegmentedBackButton extends StatelessWidget {
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => cupertino
|
||||
? CupertinoNavigationBarBackButton(onPressed: onPressed)
|
||||
: BackButton(onPressed: onPressed);
|
||||
Widget build(BuildContext context) => BackButton(onPressed: onPressed);
|
||||
}
|
||||
|
||||
/// What a bar implies on the leading edge when the page gave none, matching
|
||||
@@ -68,17 +64,6 @@ Widget? impliedSegmentedLeading(BuildContext context, bool cupertino) {
|
||||
final route = ModalRoute.of(context);
|
||||
if (route == null) return null;
|
||||
final dialog = route is PageRoute && route.fullscreenDialog;
|
||||
if (cupertino) {
|
||||
if (!route.canPop) return null;
|
||||
if (dialog) {
|
||||
return CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
onPressed: () => route.navigator?.maybePop(),
|
||||
child: Text(CupertinoLocalizations.of(context).cancelButtonLabel),
|
||||
);
|
||||
}
|
||||
return const SegmentedBackButton(cupertino: true);
|
||||
}
|
||||
if (!route.impliesAppBarDismissal) return null;
|
||||
return dialog ? const CloseButton() : const BackButton();
|
||||
}
|
||||
@@ -89,17 +74,6 @@ Widget? impliedSegmentedLeading(BuildContext context, bool cupertino) {
|
||||
required bool cupertino,
|
||||
Color? foreground,
|
||||
}) {
|
||||
if (cupertino) {
|
||||
final text = CupertinoTheme.of(context).textTheme;
|
||||
return (
|
||||
text.textStyle.copyWith(fontWeight: FontWeight.w600, color: foreground),
|
||||
text.textStyle.copyWith(
|
||||
fontSize: 13,
|
||||
color:
|
||||
foreground ?? CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
return (
|
||||
(theme.textTheme.titleSmall ?? const TextStyle()).copyWith(
|
||||
@@ -277,18 +251,7 @@ class SegmentedTitlePill extends StatelessWidget {
|
||||
body = Semantics(
|
||||
button: true,
|
||||
label: semanticLabel,
|
||||
child: cupertino
|
||||
? CupertinoButton(
|
||||
key: buttonKey,
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: Size.zero,
|
||||
onPressed: onPressed,
|
||||
child: DefaultTextStyle.merge(
|
||||
style: titleStyle,
|
||||
child: content,
|
||||
),
|
||||
)
|
||||
: InkWell(key: buttonKey, onTap: onPressed, child: content),
|
||||
child: InkWell(key: buttonKey, onTap: onPressed, child: content),
|
||||
);
|
||||
}
|
||||
final titleAction = this.titleAction;
|
||||
|
||||
@@ -11,7 +11,7 @@ class BarIconButton extends StatelessWidget {
|
||||
const BarIconButton({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.cupertinoIcon,
|
||||
this.cupertinoIcon,
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
this.selected = false,
|
||||
@@ -21,7 +21,8 @@ class BarIconButton extends StatelessWidget {
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final IconData cupertinoIcon;
|
||||
/// Retained for source compatibility; Material rendering always uses [icon].
|
||||
final IconData? cupertinoIcon;
|
||||
|
||||
/// The tooltip and accessible name.
|
||||
final String label;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// The shared status glyph whose tooltip and accessible name say the state.
|
||||
@@ -21,7 +20,7 @@ class RunStatusIcon extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = runStatusColor(state).resolveFrom(context);
|
||||
final color = runStatusColor(state, Theme.of(context).colorScheme);
|
||||
return Tooltip(
|
||||
message: label,
|
||||
child: Semantics(
|
||||
@@ -35,14 +34,17 @@ class RunStatusIcon extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// The dynamic colour for a run state, shared by every status glyph.
|
||||
CupertinoDynamicColor runStatusColor(String state) => switch (state) {
|
||||
'succeeded' => CupertinoColors.systemGreen,
|
||||
'failed' => CupertinoColors.systemRed,
|
||||
'running' || 'active' => CupertinoColors.systemBlue,
|
||||
'waiting' => CupertinoColors.systemYellow,
|
||||
'interrupted' => CupertinoColors.systemOrange,
|
||||
_ => CupertinoColors.systemGrey,
|
||||
};
|
||||
Color runStatusColor(String state, [ColorScheme? colorScheme]) {
|
||||
final scheme = colorScheme ?? const ColorScheme.light();
|
||||
return switch (state) {
|
||||
'succeeded' => scheme.tertiary,
|
||||
'failed' => scheme.error,
|
||||
'running' || 'active' => scheme.primary,
|
||||
'waiting' => scheme.secondary,
|
||||
'interrupted' => scheme.tertiary,
|
||||
_ => scheme.onSurfaceVariant,
|
||||
};
|
||||
}
|
||||
|
||||
IconData _materialIcon(String state) => switch (state) {
|
||||
'succeeded' => Icons.check_circle_outline,
|
||||
@@ -65,7 +67,7 @@ class RunStatusKicker extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = runStatusColor(state).resolveFrom(context);
|
||||
final color = runStatusColor(state, Theme.of(context).colorScheme);
|
||||
return Row(
|
||||
key: const Key('run-status-kicker'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Material cleanup: shared UI primitives
|
||||
|
||||
- Removed live Cupertino rendering from glass pills, resize grips, segmented
|
||||
overflow, segmented press feedback, segmented pieces, floating tab buttons,
|
||||
and destination labels. Existing `cupertino` compatibility arguments remain
|
||||
where other lanes still pass them, but they no longer select a renderer.
|
||||
- Replaced run status dynamic colors with `ColorScheme` roles and updated every
|
||||
production caller. The status helper keeps an optional scheme for pure tests.
|
||||
- Focused verification: `tool/memwatch/full.sh` over the seven named Material
|
||||
and status/graph tests: 47 passed, 0 failed, peak 1555 MB.
|
||||
- `tool/analyze.sh`: clean, 0 errors/warnings/infos.
|
||||
- A broader exploratory run including `floating_bar_geometry_test.dart` failed
|
||||
only in its obsolete CupertinoApp variants because those fixtures do not
|
||||
provide MaterialLocalizations after the app became Material-only. Those
|
||||
alternate-host cases remain for the manager's consolidated test cleanup.
|
||||
- No browser capture was performed; these changes preserve existing Material
|
||||
geometry and interaction paths rather than redesigning visuals.
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/graph/domain/run_graph_state.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
|
||||
@@ -26,8 +26,9 @@ void main() {
|
||||
expect(graphStatusState('running · 2m'), 'running');
|
||||
expect(graphStatusState('waiting'), 'waiting');
|
||||
expect(graphStatusState('mystery'), 'unknown');
|
||||
expect(runStatusColor('succeeded'), CupertinoColors.systemGreen);
|
||||
expect(runStatusColor('waiting'), CupertinoColors.systemYellow);
|
||||
expect(runStatusColor('canceled'), CupertinoColors.systemGrey);
|
||||
const scheme = ColorScheme.light();
|
||||
expect(runStatusColor('succeeded', scheme), scheme.tertiary);
|
||||
expect(runStatusColor('waiting', scheme), scheme.secondary);
|
||||
expect(runStatusColor('canceled', scheme), scheme.onSurfaceVariant);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user