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.
|
// coloured, smaller text in the status's own hue.
|
||||||
final color = status == null
|
final color = status == null
|
||||||
? null
|
? null
|
||||||
: runStatusColor(graphStatusState(status)).resolveFrom(context);
|
: runStatusColor(graphStatusState(status), Theme.of(context).colorScheme);
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ class PipelineListPanel extends StatelessWidget {
|
|||||||
? null
|
? null
|
||||||
: AppListStatusDot(
|
: AppListStatusDot(
|
||||||
key: Key('pipeline-status-${pipeline.id}'),
|
key: Key('pipeline-status-${pipeline.id}'),
|
||||||
color: runStatusColor(badge.state).resolveFrom(context),
|
color: runStatusColor(badge.state, Theme.of(context).colorScheme),
|
||||||
semanticLabel: runStateLabel(badge.state),
|
semanticLabel: runStateLabel(badge.state),
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
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/adaptive/floating_bar_layout.dart';
|
||||||
import '../../../ui/layout/app_list_avatar.dart';
|
import '../../../ui/layout/app_list_avatar.dart';
|
||||||
@@ -116,7 +116,7 @@ class RunTimelineRow extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
visit.outcome,
|
visit.outcome,
|
||||||
)
|
)
|
||||||
: runStatusColor(_state).resolveFrom(context);
|
: runStatusColor(_state, Theme.of(context).colorScheme);
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -145,7 +145,7 @@ class RunTimelineRow extends StatelessWidget {
|
|||||||
divider: divider,
|
divider: divider,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
leading: AppListAvatar(
|
leading: AppListAvatar(
|
||||||
foreground: runStatusColor(state).resolveFrom(context),
|
foreground: runStatusColor(state, Theme.of(context).colorScheme),
|
||||||
child: RunStatusIcon(
|
child: RunStatusIcon(
|
||||||
state: state,
|
state: state,
|
||||||
label: visit.status.isEmpty ? 'Status unavailable' : visit.status,
|
label: visit.status.isEmpty ? 'Status unavailable' : visit.status,
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class _FactGrid extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _pill(BuildContext context, VisitFact fact) {
|
Widget _pill(BuildContext context, VisitFact fact) {
|
||||||
final color = runStatusColor(_stateOf(fact)).resolveFrom(context);
|
final color = runStatusColor(_stateOf(fact), Theme.of(context).colorScheme);
|
||||||
return DecoratedBox(
|
return DecoratedBox(
|
||||||
decoration: ShapeDecoration(
|
decoration: ShapeDecoration(
|
||||||
color: color.withValues(alpha: 0.16),
|
color: color.withValues(alpha: 0.16),
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class RunListRow extends StatelessWidget {
|
|||||||
onLongPress: selecting ? null : onLongPress,
|
onLongPress: selecting ? null : onLongPress,
|
||||||
selectionControl: selecting ? _checkbox(context) : null,
|
selectionControl: selecting ? _checkbox(context) : null,
|
||||||
leading: AppListAvatar(
|
leading: AppListAvatar(
|
||||||
foreground: runStatusColor(state).resolveFrom(context),
|
foreground: runStatusColor(state, Theme.of(context).colorScheme),
|
||||||
child: RunStatusIcon(state: state, label: runStatusLabel(run)),
|
child: RunStatusIcon(state: state, label: runStatusLabel(run)),
|
||||||
),
|
),
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/status/run_status_icon.dart';
|
import '../../../ui/status/run_status_icon.dart';
|
||||||
@@ -54,12 +54,12 @@ class RunPathMini extends StatelessWidget {
|
|||||||
final stages = path.stages.length > maxStages
|
final stages = path.stages.length > maxStages
|
||||||
? path.stages.sublist(path.stages.length - maxStages)
|
? path.stages.sublist(path.stages.length - maxStages)
|
||||||
: path.stages;
|
: path.stages;
|
||||||
final line = CupertinoColors.separator.resolveFrom(context);
|
final line = Theme.of(context).colorScheme.outlineVariant;
|
||||||
Widget box(RunPathStage stage) => Container(
|
Widget box(RunPathStage stage) => Container(
|
||||||
width: 14,
|
width: 14,
|
||||||
height: 10,
|
height: 10,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: runStatusColor(stage.state).resolveFrom(context),
|
color: runStatusColor(stage.state, Theme.of(context).colorScheme),
|
||||||
borderRadius: BorderRadius.circular(3),
|
borderRadius: BorderRadius.circular(3),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -83,7 +83,8 @@ class RunPathMini extends StatelessWidget {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: runStatusColor(
|
color: runStatusColor(
|
||||||
end == '#success' ? 'succeeded' : 'failed',
|
end == '#success' ? 'succeeded' : 'failed',
|
||||||
).resolveFrom(context),
|
Theme.of(context).colorScheme,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class RunsStatsPage extends StatelessWidget {
|
|||||||
painter: _PiePainter([
|
painter: _PiePainter([
|
||||||
for (final entry in byState.entries)
|
for (final entry in byState.entries)
|
||||||
(
|
(
|
||||||
runStatusColor(entry.key).resolveFrom(context),
|
runStatusColor(entry.key, Theme.of(context).colorScheme),
|
||||||
entry.value,
|
entry.value,
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'dart:ui' show SemanticsRole;
|
import 'dart:ui' show SemanticsRole;
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// Content-driven main navigation captions keep names visible without scaling
|
/// Content-driven main navigation captions keep names visible without scaling
|
||||||
@@ -21,12 +20,8 @@ class FloatingDestinationLabels extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final color = cupertino
|
final color = Theme.of(context).colorScheme.onSurface;
|
||||||
? CupertinoColors.label.resolveFrom(context)
|
final style = Theme.of(context).textTheme.labelSmall!;
|
||||||
: Theme.of(context).colorScheme.onSurface;
|
|
||||||
final style = cupertino
|
|
||||||
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle
|
|
||||||
: Theme.of(context).textTheme.labelSmall!;
|
|
||||||
return Semantics(
|
return Semantics(
|
||||||
role: SemanticsRole.tabBar,
|
role: SemanticsRole.tabBar,
|
||||||
container: true,
|
container: true,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:ui' show SemanticsRole;
|
import 'dart:ui' show SemanticsRole;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@@ -73,40 +72,24 @@ class FloatingTabButton extends StatelessWidget {
|
|||||||
role: SemanticsRole.tab,
|
role: SemanticsRole.tab,
|
||||||
selected: selected,
|
selected: selected,
|
||||||
button: true,
|
button: true,
|
||||||
label: cupertino || kIsWeb ? label : '$label\n${_tabLabel(context)}',
|
label: kIsWeb ? label : '$label\n${_tabLabel(context)}',
|
||||||
hint: cupertino ? _tabLabel(context) : null,
|
|
||||||
// Switching tabs does not unfocus a text field (the composer).
|
// Switching tabs does not unfocus a text field (the composer).
|
||||||
child: TextFieldTapRegion(
|
child: TextFieldTapRegion(
|
||||||
child: cupertino
|
child: Tooltip(
|
||||||
? button
|
message: label,
|
||||||
: Tooltip(
|
excludeFromSemantics: true,
|
||||||
message: label,
|
child: button,
|
||||||
excludeFromSemantics: true,
|
),
|
||||||
child: button,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _tabLabel(BuildContext context) => cupertino
|
String _tabLabel(BuildContext context) => MaterialLocalizations.of(
|
||||||
? CupertinoLocalizations.of(
|
|
||||||
context,
|
|
||||||
).tabSemanticsLabel(tabIndex: index + 1, tabCount: count)
|
|
||||||
: MaterialLocalizations.of(
|
|
||||||
context,
|
context,
|
||||||
).tabLabel(tabIndex: index + 1, tabCount: count);
|
).tabLabel(tabIndex: index + 1, tabCount: count);
|
||||||
|
|
||||||
({Color tint, Color selectedIcon, Color icon}) _colors(BuildContext context) {
|
({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;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
return (
|
return (
|
||||||
tint: scheme.secondaryContainer,
|
tint: scheme.secondaryContainer,
|
||||||
@@ -125,21 +108,7 @@ class FloatingTabButton extends StatelessWidget {
|
|||||||
color: colors.tint.withValues(alpha: colors.tint.a * t),
|
color: colors.tint.withValues(alpha: colors.tint.a * t),
|
||||||
shape: const CircleBorder(),
|
shape: const CircleBorder(),
|
||||||
);
|
);
|
||||||
final Widget fill = cupertino
|
final Widget fill = Ink(
|
||||||
? 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(
|
|
||||||
key: fillKey,
|
key: fillKey,
|
||||||
decoration: decoration,
|
decoration: decoration,
|
||||||
child: InkResponse(
|
child: InkResponse(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'glass_pill.dart';
|
import 'glass_pill.dart';
|
||||||
@@ -20,11 +19,10 @@ abstract final class GlassBarMetrics {
|
|||||||
static const double fieldEdgeGap = 4;
|
static const double fieldEdgeGap = 4;
|
||||||
|
|
||||||
/// The square target of one control: the platform's minimum touch target.
|
/// The square target of one control: the platform's minimum touch target.
|
||||||
static double controlExtent(bool cupertino) =>
|
static double controlExtent(bool cupertino) => kMinInteractiveDimension;
|
||||||
cupertino ? kMinInteractiveDimensionCupertino : kMinInteractiveDimension;
|
|
||||||
|
|
||||||
/// The icon drawn inside a control's target.
|
/// 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.
|
/// The space between a control's icon and the edge of its target.
|
||||||
static double iconInset(bool cupertino) =>
|
static double iconInset(bool cupertino) =>
|
||||||
@@ -44,8 +42,8 @@ abstract final class GlassBarMetrics {
|
|||||||
minHeight: controlExtent(false),
|
minHeight: controlExtent(false),
|
||||||
);
|
);
|
||||||
|
|
||||||
/// The Cupertino minimum size of one control.
|
/// Compatibility helper for callers still passing the old control family.
|
||||||
static Size cupertinoMinimumSize() => Size.square(controlExtent(true));
|
static Size cupertinoMinimumSize() => Size.square(controlExtent(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [GlassPill] padded by [GlassBarMetrics.edgeGap] on every side around
|
/// 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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'glass_surface.dart';
|
import 'glass_surface.dart';
|
||||||
@@ -68,16 +67,9 @@ class GlassPill extends StatelessWidget {
|
|||||||
final textDirection = Directionality.maybeOf(context);
|
final textDirection = Directionality.maybeOf(context);
|
||||||
final Color base;
|
final Color base;
|
||||||
final Color edge;
|
final Color edge;
|
||||||
if (cupertino) {
|
final scheme = Theme.of(context).colorScheme;
|
||||||
// Grey 5 stays visibly raised over both the black dark canvas and the
|
base = scheme.surfaceContainerHigh;
|
||||||
// white light canvas; Grey 6 disappears into either one when blurred.
|
edge = scheme.outlineVariant;
|
||||||
base = CupertinoColors.systemGrey5.resolveFrom(context);
|
|
||||||
edge = CupertinoColors.separator.resolveFrom(context);
|
|
||||||
} else {
|
|
||||||
final scheme = Theme.of(context).colorScheme;
|
|
||||||
base = scheme.surfaceContainerHigh;
|
|
||||||
edge = scheme.outlineVariant;
|
|
||||||
}
|
|
||||||
final opaque = fill ?? (solid ? base : base.withValues(alpha: fillOpacity));
|
final opaque = fill ?? (solid ? base : base.withValues(alpha: fillOpacity));
|
||||||
final color = opaque.withValues(alpha: opaque.a * reveal);
|
final color = opaque.withValues(alpha: opaque.a * reveal);
|
||||||
final look = GlassLook.forFill(opaque);
|
final look = GlassLook.forFill(opaque);
|
||||||
@@ -86,9 +78,7 @@ class GlassPill extends StatelessWidget {
|
|||||||
final border = shape.copyWith(
|
final border = shape.copyWith(
|
||||||
side: BorderSide(color: faded(edge, solid ? 1 : 0.6), width: 0.5),
|
side: BorderSide(color: faded(edge, solid ? 1 : 0.6), width: 0.5),
|
||||||
);
|
);
|
||||||
Widget content = cupertino
|
Widget content = Material(type: MaterialType.transparency, child: child);
|
||||||
? child
|
|
||||||
: Material(type: MaterialType.transparency, child: child);
|
|
||||||
if (!solid) {
|
if (!solid) {
|
||||||
// The highlight lies on the fill under the content; the rim is drawn
|
// The highlight lies on the fill under the content; the rim is drawn
|
||||||
// over the content (and its ink) so the edge stays clean.
|
// 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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'host.dart';
|
|
||||||
|
|
||||||
/// A native-themed affordance for a draggable pane divider.
|
/// A native-themed affordance for a draggable pane divider.
|
||||||
class AdaptiveResizeGrip extends StatelessWidget {
|
class AdaptiveResizeGrip extends StatelessWidget {
|
||||||
const AdaptiveResizeGrip({
|
const AdaptiveResizeGrip({
|
||||||
@@ -18,31 +15,24 @@ class AdaptiveResizeGrip extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
return RotatedBox(
|
return RotatedBox(
|
||||||
quarterTurns: axis == Axis.vertical ? 1 : 0,
|
quarterTurns: axis == Axis.vertical ? 1 : 0,
|
||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
? CupertinoColors.secondarySystemBackground.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.surfaceContainerHigh,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: emphasized
|
border: emphasized
|
||||||
? Border.all(
|
? Border.all(
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.primary,
|
||||||
? CupertinoTheme.of(context).primaryColor
|
|
||||||
: Theme.of(context).colorScheme.primary,
|
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: compact ? 6 : 8),
|
padding: EdgeInsets.symmetric(horizontal: compact ? 6 : 8),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
cupertino ? CupertinoIcons.minus : Icons.drag_handle,
|
Icons.drag_handle,
|
||||||
size: compact ? 12 : 18,
|
size: compact ? 12 : 18,
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/physics.dart';
|
import 'package:flutter/physics.dart';
|
||||||
|
|
||||||
@@ -104,9 +103,7 @@ class _SegmentedPressState extends State<SegmentedPress>
|
|||||||
|
|
||||||
Color _tint(BuildContext context) {
|
Color _tint(BuildContext context) {
|
||||||
if (widget.tint case final tint?) return tint;
|
if (widget.tint case final tint?) return tint;
|
||||||
return widget.cupertino
|
return Theme.of(context).colorScheme.onSurface;
|
||||||
? CupertinoColors.label.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'app_menu_anchor.dart';
|
import 'app_menu_anchor.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// The key of a [SegmentedBar]'s More button, shown when its actions do not
|
/// The key of a [SegmentedBar]'s More button, shown when its actions do not
|
||||||
@@ -85,20 +84,6 @@ class SegmentedMoreButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return AppMenuAnchor(
|
||||||
menuChildren: [
|
menuChildren: [
|
||||||
for (final entry in entries)
|
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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'glass_pill.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
|
/// The smallest height of every piece of a [SegmentedBar]: the platform's
|
||||||
/// minimum touch target, so a round Back is a circle.
|
/// minimum touch target, so a round Back is a circle.
|
||||||
double segmentedPieceHeight(bool cupertino) =>
|
double segmentedPieceHeight(bool cupertino) =>
|
||||||
cupertino ? kMinInteractiveDimensionCupertino : kMinInteractiveDimension;
|
kMinInteractiveDimension;
|
||||||
|
|
||||||
/// One rounded piece of a segmented bar: a [GlassPill] at least the
|
/// One rounded piece of a segmented bar: a [GlassPill] at least the
|
||||||
/// platform's touch-target size.
|
/// platform's touch-target size.
|
||||||
@@ -42,8 +41,7 @@ class SegmentedPill extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The platform's own Back for a segmented bar: Material [BackButton],
|
/// The app's Material Back button for a segmented bar. A null [onPressed] keeps the
|
||||||
/// Cupertino [CupertinoNavigationBarBackButton]. A null [onPressed] keeps the
|
|
||||||
/// stock action (pop the route).
|
/// stock action (pop the route).
|
||||||
class SegmentedBackButton extends StatelessWidget {
|
class SegmentedBackButton extends StatelessWidget {
|
||||||
const SegmentedBackButton({
|
const SegmentedBackButton({
|
||||||
@@ -56,9 +54,7 @@ class SegmentedBackButton extends StatelessWidget {
|
|||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => cupertino
|
Widget build(BuildContext context) => BackButton(onPressed: onPressed);
|
||||||
? CupertinoNavigationBarBackButton(onPressed: onPressed)
|
|
||||||
: BackButton(onPressed: onPressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// What a bar implies on the leading edge when the page gave none, matching
|
/// 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);
|
final route = ModalRoute.of(context);
|
||||||
if (route == null) return null;
|
if (route == null) return null;
|
||||||
final dialog = route is PageRoute && route.fullscreenDialog;
|
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;
|
if (!route.impliesAppBarDismissal) return null;
|
||||||
return dialog ? const CloseButton() : const BackButton();
|
return dialog ? const CloseButton() : const BackButton();
|
||||||
}
|
}
|
||||||
@@ -89,17 +74,6 @@ Widget? impliedSegmentedLeading(BuildContext context, bool cupertino) {
|
|||||||
required bool cupertino,
|
required bool cupertino,
|
||||||
Color? foreground,
|
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);
|
final theme = Theme.of(context);
|
||||||
return (
|
return (
|
||||||
(theme.textTheme.titleSmall ?? const TextStyle()).copyWith(
|
(theme.textTheme.titleSmall ?? const TextStyle()).copyWith(
|
||||||
@@ -277,18 +251,7 @@ class SegmentedTitlePill extends StatelessWidget {
|
|||||||
body = Semantics(
|
body = Semantics(
|
||||||
button: true,
|
button: true,
|
||||||
label: semanticLabel,
|
label: semanticLabel,
|
||||||
child: cupertino
|
child: InkWell(key: buttonKey, onTap: onPressed, child: content),
|
||||||
? 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),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final titleAction = this.titleAction;
|
final titleAction = this.titleAction;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class BarIconButton extends StatelessWidget {
|
|||||||
const BarIconButton({
|
const BarIconButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.cupertinoIcon,
|
this.cupertinoIcon,
|
||||||
required this.label,
|
required this.label,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.selected = false,
|
this.selected = false,
|
||||||
@@ -21,7 +21,8 @@ class BarIconButton extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final IconData cupertinoIcon;
|
/// Retained for source compatibility; Material rendering always uses [icon].
|
||||||
|
final IconData? cupertinoIcon;
|
||||||
|
|
||||||
/// The tooltip and accessible name.
|
/// The tooltip and accessible name.
|
||||||
final String label;
|
final String label;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// The shared status glyph whose tooltip and accessible name say the state.
|
/// The shared status glyph whose tooltip and accessible name say the state.
|
||||||
@@ -21,7 +20,7 @@ class RunStatusIcon extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final color = runStatusColor(state).resolveFrom(context);
|
final color = runStatusColor(state, Theme.of(context).colorScheme);
|
||||||
return Tooltip(
|
return Tooltip(
|
||||||
message: label,
|
message: label,
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
@@ -35,14 +34,17 @@ class RunStatusIcon extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The dynamic colour for a run state, shared by every status glyph.
|
/// The dynamic colour for a run state, shared by every status glyph.
|
||||||
CupertinoDynamicColor runStatusColor(String state) => switch (state) {
|
Color runStatusColor(String state, [ColorScheme? colorScheme]) {
|
||||||
'succeeded' => CupertinoColors.systemGreen,
|
final scheme = colorScheme ?? const ColorScheme.light();
|
||||||
'failed' => CupertinoColors.systemRed,
|
return switch (state) {
|
||||||
'running' || 'active' => CupertinoColors.systemBlue,
|
'succeeded' => scheme.tertiary,
|
||||||
'waiting' => CupertinoColors.systemYellow,
|
'failed' => scheme.error,
|
||||||
'interrupted' => CupertinoColors.systemOrange,
|
'running' || 'active' => scheme.primary,
|
||||||
_ => CupertinoColors.systemGrey,
|
'waiting' => scheme.secondary,
|
||||||
};
|
'interrupted' => scheme.tertiary,
|
||||||
|
_ => scheme.onSurfaceVariant,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
IconData _materialIcon(String state) => switch (state) {
|
IconData _materialIcon(String state) => switch (state) {
|
||||||
'succeeded' => Icons.check_circle_outline,
|
'succeeded' => Icons.check_circle_outline,
|
||||||
@@ -65,7 +67,7 @@ class RunStatusKicker extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final color = runStatusColor(state).resolveFrom(context);
|
final color = runStatusColor(state, Theme.of(context).colorScheme);
|
||||||
return Row(
|
return Row(
|
||||||
key: const Key('run-status-kicker'),
|
key: const Key('run-status-kicker'),
|
||||||
mainAxisSize: MainAxisSize.min,
|
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:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/features/graph/domain/run_graph_state.dart';
|
import 'package:pipelines_app/features/graph/domain/run_graph_state.dart';
|
||||||
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.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('running · 2m'), 'running');
|
||||||
expect(graphStatusState('waiting'), 'waiting');
|
expect(graphStatusState('waiting'), 'waiting');
|
||||||
expect(graphStatusState('mystery'), 'unknown');
|
expect(graphStatusState('mystery'), 'unknown');
|
||||||
expect(runStatusColor('succeeded'), CupertinoColors.systemGreen);
|
const scheme = ColorScheme.light();
|
||||||
expect(runStatusColor('waiting'), CupertinoColors.systemYellow);
|
expect(runStatusColor('succeeded', scheme), scheme.tertiary);
|
||||||
expect(runStatusColor('canceled'), CupertinoColors.systemGrey);
|
expect(runStatusColor('waiting', scheme), scheme.secondary);
|
||||||
|
expect(runStatusColor('canceled', scheme), scheme.onSurfaceVariant);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user