Merge commit 'b556e76778001e36621b3cadfd38b06b9cf2b476' into pipelines/run-20261111-2114-finish-remaining-material-only-probe-hos-0220

This commit is contained in:
2026-11-11 21:38:41 +00:00
31 changed files with 581 additions and 635 deletions
@@ -108,7 +108,10 @@ 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,10 @@ 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(
@@ -280,10 +283,7 @@ class PipelineListPanel extends StatelessWidget {
/// The pipeline's initial on a tint picked from its id, so neighbouring /// The pipeline's initial on a tint picked from its id, so neighbouring
/// pipelines are told apart at a glance. /// pipelines are told apart at a glance.
Widget _pipelineIdentityIcon( Widget _pipelineIdentityIcon(BuildContext context, PipelineSummary pipeline) {
BuildContext context,
PipelineSummary pipeline,
) {
final scheme = Theme.of(context).colorScheme; final scheme = Theme.of(context).colorScheme;
final colors = [scheme.primary, scheme.secondary, scheme.tertiary]; final colors = [scheme.primary, scheme.secondary, scheme.tertiary];
return Semantics( return Semantics(
@@ -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),
+1 -1
View File
@@ -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),
+3 -2
View File
@@ -59,7 +59,7 @@ class RunPathMini extends StatelessWidget {
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,
),
), ),
), ),
], ],
@@ -14,9 +14,9 @@ import 'runs_controller.dart';
/// Opens the runs' usage and charts on their own page. /// Opens the runs' usage and charts on their own page.
Future<void> openRunsStats(BuildContext context, RunsController controller) { Future<void> openRunsStats(BuildContext context, RunsController controller) {
final page = RunsStatsPage(controller: controller); final page = RunsStatsPage(controller: controller);
return Navigator.of(context).push<void>( return Navigator.of(
MaterialPageRoute<void>(builder: (_) => page), context,
); ).push<void>(MaterialPageRoute<void>(builder: (_) => page));
} }
/// Usage totals, runs by status (a pie) and runs per day for the last week. /// Usage totals, runs by status (a pie) and runs per day for the last week.
@@ -92,7 +92,10 @@ 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,
+19 -50
View File
@@ -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,
context, ).tabLabel(tabIndex: index + 1, tabCount: count);
).tabSemanticsLabel(tabIndex: index + 1, tabCount: count)
: MaterialLocalizations.of(
context,
).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,30 +108,16 @@ 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,
key: fillKey, decoration: decoration,
decoration: decoration, child: InkResponse(
child: MouseRegion( onTap: onTap,
cursor: kIsWeb ? SystemMouseCursors.click : MouseCursor.defer, customBorder: const CircleBorder(),
child: GestureDetector( containedInkWell: true,
behavior: HitTestBehavior.opaque, highlightShape: BoxShape.circle,
onTap: onTap, ),
), );
),
)
// Painted on the glass's Material, under the ink, so the ripple
// shows over the selected tint too.
: Ink(
key: fillKey,
decoration: decoration,
child: InkResponse(
onTap: onTap,
customBorder: const CircleBorder(),
containedInkWell: true,
highlightShape: BoxShape.circle,
),
);
Widget glyph = IconTheme.merge( Widget glyph = IconTheme.merge(
data: IconThemeData( data: IconThemeData(
size: iconSize, size: iconSize,
+4 -6
View File
@@ -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
+4 -14
View File
@@ -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.
+4 -16
View File
@@ -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,22 @@ 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: Theme.of(context).colorScheme.primary)
color: cupertino
? 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)
@@ -137,46 +122,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'),
),
),
);
} }
+4 -42
View File
@@ -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';
@@ -6,8 +5,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) => kMinInteractiveDimension;
cupertino ? kMinInteractiveDimensionCupertino : 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 +40,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 +53,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 +63,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 +73,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 +250,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;
+4 -2
View File
@@ -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,9 @@ 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;
+13 -11
View File
@@ -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,
+13
View File
@@ -0,0 +1,13 @@
# Populated desktop review fixtures
The full-app fake gateway's `chats=2&header=1` scenario now supplies model and
permission-mode catalogs as well as thinking levels. Selections are validated
and retained per chat, without contacting providers or changing real settings.
This closes the earlier selector review's unsupported-catalog limitation.
- Fixture tests: 2 passed; explicit tool-file analysis: clean.
- Full-app web probe build: passed.
- Inspected populated model, permission, and thinking menus at 1600×1000, dark
theme. All use the shared anchored Material choice surface and checked rows.
- Final broad desktop review still follows integrated cleanup; these captures
are focused fixture verification, not a claim of completed overall review.
@@ -0,0 +1,21 @@
# 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.
- Removed obsolete Cupertino variants from the run-path and segmented-bar
mirrored tests; Material color-scheme roles and Material host/localizations
are now the only assertions in those fixtures. Focused rerun: 14 passed,
0 failed.
- `tool/analyze.sh`: clean, 0 errors/warnings/infos.
- Removed the obsolete CupertinoApp variants from
`floating_tab_motion_test.dart`; the Material motion coverage now runs under
`MaterialApp` only. Focused rerun of the floating-tab, segmented-bar, and
run-path tests: 16 passed, 0 failed.
- 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);
}); });
} }
@@ -42,14 +42,10 @@ void main() {
.whereType<Color>() .whereType<Color>()
.map((color) => color.toARGB32()) .map((color) => color.toARGB32())
.toList(); .toList();
final context = tester.element(find.byKey(const Key('run-path-mini'))); final scheme = Theme.of(
expect( tester.element(find.byKey(const Key('run-path-mini'))),
colors, ).colorScheme;
contains(runStatusColor('succeeded').resolveFrom(context).toARGB32()), expect(colors, contains(runStatusColor('succeeded', scheme).toARGB32()));
); expect(colors, contains(runStatusColor('failed', scheme).toARGB32()));
expect(
colors,
contains(runStatusColor('failed').resolveFrom(context).toARGB32()),
);
}); });
} }
+61
View File
@@ -0,0 +1,61 @@
import 'package:flutter_test/flutter_test.dart';
import '../../tool/perf/chat_catalog_fixture.dart';
void main() {
test('catalogs are populated and selection is isolated per chat', () {
final fixture = ChatCatalogFixture();
expect(
fixture.reply({'type': 'chat_models'})!['chat_models'],
hasLength(2),
);
expect(fixture.reply({'type': 'chat_modes'})!['chat_modes'], hasLength(3));
expect(
fixture.reply({
'type': 'chat_model',
'chat_model': {
'session_id': 'a',
'provider': 'openai',
'model': 'openai/gpt-5.6-luna',
},
})!['type'],
'chat_model',
);
expect(
fixture.reply({
'type': 'chat_mode',
'chat_mode': {'session_id': 'a', 'mode': 'plan'},
})!['type'],
'chat_mode',
);
expect(fixture.rowFields('a')['model'], 'openai/gpt-5.6-luna');
expect(fixture.rowFields('a')['mode_name'], 'Plan only');
expect(fixture.rowFields('b')['model'], 'openai/gpt-6.1');
expect(fixture.rowFields('b')['mode'], 'default');
});
test('invalid selections do not mutate catalog state', () {
final fixture = ChatCatalogFixture();
final before = fixture.rowFields('a');
expect(
fixture.reply({
'type': 'chat_mode',
'chat_mode': {'session_id': 'a', 'mode': 'not-a-mode'},
})!['type'],
'error',
);
expect(
fixture.reply({
'type': 'chat_model',
'chat_model': {
'session_id': 'a',
'provider': 'unknown',
'model': 'unknown',
},
})!['type'],
'error',
);
expect(fixture.rowFields('a'), before);
expect(fixture.reply({'type': 'chat_messages'}), isNull);
});
}
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
@@ -54,11 +53,7 @@ void main() {
), ),
child: child, child: child,
); );
await tester.pumpWidget( await tester.pumpWidget(MaterialApp(home: Scaffold(body: body)));
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: body))
: MaterialApp(home: Scaffold(body: body)),
);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
} }
@@ -80,18 +75,17 @@ void main() {
(name: 'phone 560, 5 tabs', size: const Size(560, 844), count: 5), (name: 'phone 560, 5 tabs', size: const Size(560, 844), count: 5),
]; ];
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
const host = 'Material';
final diameter = FloatingDestinationBar.buttonSize(cupertino: cupertino); final diameter = FloatingDestinationBar.buttonSize(cupertino: cupertino);
final gap = FloatingDestinationBar.buttonGap(cupertino: cupertino); final gap = FloatingDestinationBar.buttonGap(cupertino: cupertino);
final iconSize = cupertino final iconSize = FloatingDestinationBar.materialIconSize;
? FloatingDestinationBar.cupertinoIconSize
: FloatingDestinationBar.materialIconSize;
test('$host: buttons are larger than the old 44/42 circle, hit targets ' test('$host: buttons are larger than the old 44/42 circle, hit targets '
'meet the platform minimum', () { 'meet the platform minimum', () {
expect(diameter, cupertino ? 50 : 52); expect(diameter, 52);
expect(diameter, greaterThanOrEqualTo(cupertino ? 44 : 48)); expect(diameter, greaterThanOrEqualTo(48));
expect(gap, inInclusiveRange(10, 12)); expect(gap, inInclusiveRange(10, 12));
}); });
+189 -204
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart';
@@ -39,25 +38,18 @@ void main() {
addTearDown(tester.view.reset); addTearDown(tester.view.reset);
} }
Widget app(bool cupertino, Widget body) => cupertino Widget app(Widget body) => MaterialApp(home: Scaffold(body: body));
? CupertinoApp(home: CupertinoPageScaffold(child: body))
: MaterialApp(home: Scaffold(body: body));
/// A bar of [count] tabs whose tap selects. /// A bar of [count] tabs whose tap selects.
Future<void> pumpBar( Future<void> pumpBar(WidgetTester tester, {int count = 3}) async {
WidgetTester tester, {
required bool cupertino,
int count = 3,
}) async {
var selected = 0; var selected = 0;
await tester.pumpWidget( await tester.pumpWidget(
app( app(
cupertino,
StatefulBuilder( StatefulBuilder(
builder: (context, setState) => Align( builder: (context, setState) => Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: FloatingDestinationBar( child: FloatingDestinationBar(
cupertino: cupertino, cupertino: false,
currentIndex: selected, currentIndex: selected,
onTap: (index) => setState(() => selected = index), onTap: (index) => setState(() => selected = index),
items: items(count), items: items(count),
@@ -102,205 +94,198 @@ void main() {
return (decoration! as ShapeDecoration).color!.a; return (decoration! as ShapeDecoration).color!.a;
} }
for (final cupertino in [false, true]) { final host = 'Material';
final host = cupertino ? 'Cupertino' : 'Material'; final size = FloatingDestinationBar.buttonSize(cupertino: false);
final size = FloatingDestinationBar.buttonSize(cupertino: cupertino); final iconSize = FloatingDestinationBar.materialIconSize;
final iconSize = cupertino
? FloatingDestinationBar.cupertinoIconSize
: FloatingDestinationBar.materialIconSize;
testWidgets('$host: each button pops in on its own, staggered, from ' testWidgets('$host: each button pops in on its own, staggered, from '
'0.6 to full size', (tester) async { '0.6 to full size', (tester) async {
animate(tester, on: true); animate(tester, on: true);
await pumpBar(tester, cupertino: cupertino); await pumpBar(tester);
for (var index = 0; index < 3; index += 1) { for (var index = 0; index < 3; index += 1) {
final tab = find.byKey(tabKey(index)); final tab = find.byKey(tabKey(index));
expect(opacityOf(tester, tab), 0); expect(opacityOf(tester, tab), 0);
final rest = index == 0 final rest = index == 0
? FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) ? FloatingDestinationBar.selectedButtonSize(cupertino: false)
: size; : size;
expect(widthOf(tester, tab), moreOrLessEquals(rest * 0.6)); expect(widthOf(tester, tab), moreOrLessEquals(rest * 0.6));
} }
await tester.pump(const Duration(milliseconds: 130)); await tester.pump(const Duration(milliseconds: 130));
final first = widthOf(tester, find.byKey(tabKey(0))); final first = widthOf(tester, find.byKey(tabKey(0)));
final last = widthOf(tester, find.byKey(tabKey(2))); final last = widthOf(tester, find.byKey(tabKey(2)));
expect(first, greaterThan(last + 4), reason: 'staggered'); expect(first, greaterThan(last + 4), reason: 'staggered');
expect(opacityOf(tester, find.byKey(tabKey(0))), greaterThan(0.9)); expect(opacityOf(tester, find.byKey(tabKey(0))), greaterThan(0.9));
expect(opacityOf(tester, find.byKey(tabKey(2))), lessThan(0.2)); expect(opacityOf(tester, find.byKey(tabKey(2))), lessThan(0.2));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
for (var index = 0; index < 3; index += 1) { for (var index = 0; index < 3; index += 1) {
final tab = find.byKey(tabKey(index)); final tab = find.byKey(tabKey(index));
expect(opacityOf(tester, tab), 1); expect(opacityOf(tester, tab), 1);
// Tab 0 is selected, so it settles at the larger size. // Tab 0 is selected, so it settles at the larger size.
expect(
widthOf(tester, tab),
index == 0
? FloatingDestinationBar.selectedButtonSize(cupertino: cupertino)
: size,
);
}
});
testWidgets('$host: the entrance does not replay when the selection '
'changes', (tester) async {
animate(tester, on: true);
await pumpBar(tester, cupertino: cupertino);
await tester.pumpAndSettle();
for (final target in [1, 2, 0]) {
await tester.tap(find.byKey(tabKey(target)));
for (var frame = 0; frame < 12; frame += 1) {
await tester.pump(const Duration(milliseconds: 25));
for (var index = 0; index < 3; index += 1) {
final tab = find.byKey(tabKey(index));
expect(opacityOf(tester, tab), 1, reason: 'tab $index faded');
// The selection grows and shrinks buttons between their two
// sizes and the press sinks the tapped one a little; a replayed
// pop would start at 0.6.
expect(
widthOf(tester, tab),
greaterThan(size * 0.9),
reason: 'tab $index popped again',
);
}
}
await tester.pumpAndSettle();
}
});
testWidgets('$host: a new set of tabs pops in again', (tester) async {
animate(tester, on: true);
var count = 3;
late StateSetter update;
await tester.pumpWidget(
app(
cupertino,
StatefulBuilder(
builder: (context, setState) {
update = setState;
return Align(
alignment: Alignment.bottomCenter,
child: FloatingDestinationBar(
cupertino: cupertino,
currentIndex: 0,
onTap: (_) {},
items: items(count),
),
);
},
),
),
);
await tester.pumpAndSettle();
expect(opacityOf(tester, find.byKey(tabKey(2))), 1);
update(() => count = 4);
await tester.pump();
expect(opacityOf(tester, find.byKey(tabKey(3))), 0);
expect(opacityOf(tester, find.byKey(tabKey(2))), 0);
await tester.pumpAndSettle();
expect(opacityOf(tester, find.byKey(tabKey(3))), 1);
expect(widthOf(tester, find.byKey(tabKey(3))), size);
});
testWidgets('$host: the selection tint cross-fades to the new button, '
'whose icon takes the selected colour and bounces', (tester) async {
animate(tester, on: true);
await pumpBar(tester, cupertino: cupertino);
await tester.pumpAndSettle();
final tint = fillAlpha(tester, 0);
expect(tint, greaterThan(0.1));
expect(fillAlpha(tester, 1), 0);
expect(fillAlpha(tester, 2), 0);
await tester.tap(find.byKey(tabKey(2)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 80));
expect(fillAlpha(tester, 2), inExclusiveRange(0, tint));
expect(fillAlpha(tester, 0), inExclusiveRange(0, tint));
// The icon grows within its button (which the tap's press sinks).
expect(
iconWidth(tester, 2) * size / widthOf(tester, find.byKey(tabKey(2))),
greaterThan(iconSize * 1.04),
);
expect(iconWidth(tester, 1), moreOrLessEquals(iconSize));
await tester.pumpAndSettle();
expect(fillAlpha(tester, 2), tint);
expect(fillAlpha(tester, 0), 0);
// At rest the selected icon is a little larger than the others.
expect(
iconWidth(tester, 2),
moreOrLessEquals(
iconSize *
FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) /
FloatingDestinationBar.buttonSize(cupertino: cupertino),
),
);
expect(iconWidth(tester, 0), moreOrLessEquals(iconSize));
expect(iconWidth(tester, 1), moreOrLessEquals(iconSize));
final context = tester.element(find.byKey(tabKey(2)));
final selectedColour = cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.onSecondaryContainer;
expect(
IconTheme.of(tester.element(find.byIcon(icons[2]))).color,
isSameColorAs(selectedColour),
);
expect(
IconTheme.of(tester.element(find.byIcon(icons[0]))).color,
isNot(isSameColorAs(selectedColour)),
);
});
testWidgets('$host: a press sinks the button and it springs back', (
tester,
) async {
animate(tester, on: true);
await pumpBar(tester, cupertino: cupertino);
await tester.pumpAndSettle();
final tab = find.byKey(tabKey(1));
final gesture = await tester.startGesture(tester.getCenter(tab));
await tester.pump();
await tester.pump(const Duration(milliseconds: 120));
expect(widthOf(tester, tab), lessThan(size * 0.97));
// Tab 0 is selected, so it is the larger button; the press leaves it.
expect(
widthOf(tester, find.byKey(tabKey(0))),
FloatingDestinationBar.selectedButtonSize(cupertino: cupertino),
);
await gesture.up();
await tester.pumpAndSettle();
// The tap selected it: it springs back to the selected size.
expect( expect(
widthOf(tester, tab), widthOf(tester, tab),
FloatingDestinationBar.selectedButtonSize(cupertino: cupertino), index == 0
? FloatingDestinationBar.selectedButtonSize(cupertino: false)
: size,
); );
}); }
});
testWidgets('$host: under reduced motion the tint jumps and the buttons ' testWidgets('$host: the entrance does not replay when the selection '
'neither pop nor bounce', (tester) async { 'changes', (tester) async {
animate(tester, on: false); animate(tester, on: true);
await pumpBar(tester, cupertino: cupertino); await pumpBar(tester);
await tester.pump(); await tester.pumpAndSettle();
expect(opacityOf(tester, find.byKey(tabKey(1))), 1); for (final target in [1, 2, 0]) {
expect(widthOf(tester, find.byKey(tabKey(1))), size); await tester.tap(find.byKey(tabKey(target)));
final tint = fillAlpha(tester, 0); for (var frame = 0; frame < 12; frame += 1) {
await tester.tap(find.byKey(tabKey(2))); await tester.pump(const Duration(milliseconds: 25));
await tester.pump(); for (var index = 0; index < 3; index += 1) {
await tester.pump(); final tab = find.byKey(tabKey(index));
expect(fillAlpha(tester, 2), tint); expect(opacityOf(tester, tab), 1, reason: 'tab $index faded');
expect(fillAlpha(tester, 0), 0); // The selection grows and shrinks buttons between their two
// No bounce, and the selected icon jumps straight to its larger size. // sizes and the press sinks the tapped one a little; a replayed
expect( // pop would start at 0.6.
iconWidth(tester, 2), expect(
moreOrLessEquals( widthOf(tester, tab),
iconSize * greaterThan(size * 0.9),
FloatingDestinationBar.selectedButtonSize(cupertino: cupertino) / reason: 'tab $index popped again',
FloatingDestinationBar.buttonSize(cupertino: cupertino), );
}
}
await tester.pumpAndSettle();
}
});
testWidgets('$host: a new set of tabs pops in again', (tester) async {
animate(tester, on: true);
var count = 3;
late StateSetter update;
await tester.pumpWidget(
app(
StatefulBuilder(
builder: (context, setState) {
update = setState;
return Align(
alignment: Alignment.bottomCenter,
child: FloatingDestinationBar(
cupertino: false,
currentIndex: 0,
onTap: (_) {},
items: items(count),
),
);
},
), ),
); ),
expect(iconWidth(tester, 0), moreOrLessEquals(iconSize)); );
}); await tester.pumpAndSettle();
} expect(opacityOf(tester, find.byKey(tabKey(2))), 1);
update(() => count = 4);
await tester.pump();
expect(opacityOf(tester, find.byKey(tabKey(3))), 0);
expect(opacityOf(tester, find.byKey(tabKey(2))), 0);
await tester.pumpAndSettle();
expect(opacityOf(tester, find.byKey(tabKey(3))), 1);
expect(widthOf(tester, find.byKey(tabKey(3))), size);
});
testWidgets('$host: the selection tint cross-fades to the new button, '
'whose icon takes the selected colour and bounces', (tester) async {
animate(tester, on: true);
await pumpBar(tester);
await tester.pumpAndSettle();
final tint = fillAlpha(tester, 0);
expect(tint, greaterThan(0.1));
expect(fillAlpha(tester, 1), 0);
expect(fillAlpha(tester, 2), 0);
await tester.tap(find.byKey(tabKey(2)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 80));
expect(fillAlpha(tester, 2), inExclusiveRange(0, tint));
expect(fillAlpha(tester, 0), inExclusiveRange(0, tint));
// The icon grows within its button (which the tap's press sinks).
expect(
iconWidth(tester, 2) * size / widthOf(tester, find.byKey(tabKey(2))),
greaterThan(iconSize * 1.04),
);
expect(iconWidth(tester, 1), moreOrLessEquals(iconSize));
await tester.pumpAndSettle();
expect(fillAlpha(tester, 2), tint);
expect(fillAlpha(tester, 0), 0);
// At rest the selected icon is a little larger than the others.
expect(
iconWidth(tester, 2),
moreOrLessEquals(
iconSize *
FloatingDestinationBar.selectedButtonSize(cupertino: false) /
FloatingDestinationBar.buttonSize(cupertino: false),
),
);
expect(iconWidth(tester, 0), moreOrLessEquals(iconSize));
expect(iconWidth(tester, 1), moreOrLessEquals(iconSize));
final context = tester.element(find.byKey(tabKey(2)));
final selectedColour = Theme.of(context).colorScheme.onSecondaryContainer;
expect(
IconTheme.of(tester.element(find.byIcon(icons[2]))).color,
isSameColorAs(selectedColour),
);
expect(
IconTheme.of(tester.element(find.byIcon(icons[0]))).color,
isNot(isSameColorAs(selectedColour)),
);
});
testWidgets('$host: a press sinks the button and it springs back', (
tester,
) async {
animate(tester, on: true);
await pumpBar(tester);
await tester.pumpAndSettle();
final tab = find.byKey(tabKey(1));
final gesture = await tester.startGesture(tester.getCenter(tab));
await tester.pump();
await tester.pump(const Duration(milliseconds: 120));
expect(widthOf(tester, tab), lessThan(size * 0.97));
// Tab 0 is selected, so it is the larger button; the press leaves it.
expect(
widthOf(tester, find.byKey(tabKey(0))),
FloatingDestinationBar.selectedButtonSize(cupertino: false),
);
await gesture.up();
await tester.pumpAndSettle();
// The tap selected it: it springs back to the selected size.
expect(
widthOf(tester, tab),
FloatingDestinationBar.selectedButtonSize(cupertino: false),
);
});
testWidgets('$host: under reduced motion the tint jumps and the buttons '
'neither pop nor bounce', (tester) async {
animate(tester, on: false);
await pumpBar(tester);
await tester.pump();
expect(opacityOf(tester, find.byKey(tabKey(1))), 1);
expect(widthOf(tester, find.byKey(tabKey(1))), size);
final tint = fillAlpha(tester, 0);
await tester.tap(find.byKey(tabKey(2)));
await tester.pump();
await tester.pump();
expect(fillAlpha(tester, 2), tint);
expect(fillAlpha(tester, 0), 0);
// No bounce, and the selected icon jumps straight to its larger size.
expect(
iconWidth(tester, 2),
moreOrLessEquals(
iconSize *
FloatingDestinationBar.selectedButtonSize(cupertino: false) /
FloatingDestinationBar.buttonSize(cupertino: false),
),
);
expect(iconWidth(tester, 0), moreOrLessEquals(iconSize));
});
testWidgets('switching the shell tabs never replays the main ' testWidgets('switching the shell tabs never replays the main '
"bar's entrance", (tester) async { "bar's entrance", (tester) async {
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/pop_entrance.dart'; import 'package:pipelines_app/ui/adaptive/pop_entrance.dart';
@@ -26,17 +25,13 @@ void main() {
actions: actions, actions: actions,
actionsKey: actionsKey, actionsKey: actionsKey,
); );
final Widget home = cupertino final app = MaterialApp(
? CupertinoPageScaffold( home: Scaffold(
navigationBar: bar, extendBodyBehindAppBar: true,
child: const SizedBox.expand(), appBar: bar,
) body: const SizedBox.expand(),
: Scaffold( ),
extendBodyBehindAppBar: true, );
appBar: bar,
body: const SizedBox.expand(),
);
final app = cupertino ? CupertinoApp(home: home) : MaterialApp(home: home);
return MediaQuery( return MediaQuery(
data: MediaQueryData(disableAnimations: reduced), data: MediaQueryData(disableAnimations: reduced),
child: app, child: app,
@@ -60,9 +55,10 @@ void main() {
const begin = Motion.tabEntranceScaleBegin; const begin = Motion.tabEntranceScaleBegin;
const step = Motion.tabEntranceStagger; const step = Motion.tabEntranceStagger;
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
final icon = cupertino ? CupertinoIcons.refresh : Icons.refresh; const host = 'Material';
const icon = Icons.refresh;
Widget action(String key) => Widget action(String key) =>
IconButton(key: Key(key), icon: Icon(icon), onPressed: () {}); IconButton(key: Key(key), icon: Icon(icon), onPressed: () {});
final a = find.byKey(const Key('a')); final a = find.byKey(const Key('a'));
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@@ -30,17 +29,13 @@ void main() {
), ),
actions: actions, actions: actions,
); );
final Widget home = cupertino final app = MaterialApp(
? CupertinoPageScaffold( home: Scaffold(
navigationBar: bar, extendBodyBehindAppBar: true,
child: const SizedBox.expand(), appBar: bar,
) body: const SizedBox.expand(),
: Scaffold( ),
extendBodyBehindAppBar: true, );
appBar: bar,
body: const SizedBox.expand(),
);
final app = cupertino ? CupertinoApp(home: home) : MaterialApp(home: home);
return MediaQuery( return MediaQuery(
data: MediaQueryData(disableAnimations: reduced), data: MediaQueryData(disableAnimations: reduced),
child: app, child: app,
@@ -74,9 +69,10 @@ void main() {
final back = find.byKey(const Key('back')); final back = find.byKey(const Key('back'));
final title = find.text('Runs'); final title = find.text('Runs');
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
final icon = cupertino ? CupertinoIcons.refresh : Icons.refresh; const host = 'Material';
const icon = Icons.refresh;
Widget action(String key) => Widget action(String key) =>
IconButton(key: Key(key), icon: Icon(icon), onPressed: () {}); IconButton(key: Key(key), icon: Icon(icon), onPressed: () {});
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@@ -15,25 +14,12 @@ const _names = ['Needs you', 'Usage', 'Filter', 'Sort', 'Select'];
Key _key(String name) => ValueKey('action.$name'); Key _key(String name) => ValueKey('action.$name');
/// An icon action like the list bars' own, at the host's touch target. /// An icon action like the list bars' own, at the host's touch target.
Widget _icon(bool cupertino, String name, VoidCallback onPressed) => cupertino Widget _icon(bool cupertino, String name, VoidCallback onPressed) => IconButton(
? Semantics( key: _key(name),
button: true, tooltip: name,
label: name, onPressed: onPressed,
excludeSemantics: true, icon: const Icon(Icons.circle_outlined),
child: CupertinoButton( );
key: _key(name),
padding: EdgeInsets.zero,
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
onPressed: onPressed,
child: const Icon(CupertinoIcons.circle),
),
)
: IconButton(
key: _key(name),
tooltip: name,
onPressed: onPressed,
icon: const Icon(Icons.circle_outlined),
);
/// The Runs bar's shape: a bell that always stays, then four that may move. /// The Runs bar's shape: a bell that always stays, then four that may move.
List<Widget> _actions(bool cupertino, List<String> pressed) => [ List<Widget> _actions(bool cupertino, List<String> pressed) => [
@@ -52,22 +38,14 @@ List<Widget> _actions(bool cupertino, List<String> pressed) => [
]; ];
Widget _app(bool cupertino, SegmentedBar bar, {Brightness? brightness}) => Widget _app(bool cupertino, SegmentedBar bar, {Brightness? brightness}) =>
cupertino MaterialApp(
? CupertinoApp( theme: ThemeData(brightness: brightness ?? Brightness.light),
theme: CupertinoThemeData(brightness: brightness), home: Scaffold(
home: CupertinoPageScaffold( extendBodyBehindAppBar: true,
navigationBar: bar, appBar: bar,
child: const SizedBox.expand(), body: const SizedBox.expand(),
), ),
) );
: MaterialApp(
theme: ThemeData(brightness: brightness ?? Brightness.light),
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: const SizedBox.expand(),
),
);
/// Pumps the bar and the frame its More menu settles in. /// Pumps the bar and the frame its More menu settles in.
Future<void> _pump(WidgetTester tester, Widget app) async { Future<void> _pump(WidgetTester tester, Widget app) async {
@@ -87,8 +65,9 @@ bool _whole(WidgetTester tester, String text) {
} }
void main() { void main() {
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const cupertino = false;
const host = 'Material';
for (final width in [240.0, 270.0, 320.0]) { for (final width in [240.0, 270.0, 320.0]) {
for (final brightness in Brightness.values) { for (final brightness in Brightness.values) {
testWidgets('$host ${brightness.name} ${width.toInt()}px: the title ' testWidgets('$host ${brightness.name} ${width.toInt()}px: the title '
@@ -126,7 +105,7 @@ void main() {
for (final name in shown) tester.getRect(find.byKey(_key(name))), for (final name in shown) tester.getRect(find.byKey(_key(name))),
tester.getRect(more), tester.getRect(more),
]; ];
final target = cupertino ? 44.0 : 48.0; const target = 48.0;
for (final (index, rect) in rects.indexed) { for (final (index, rect) in rects.indexed) {
expect(rect.width, greaterThanOrEqualTo(target)); expect(rect.width, greaterThanOrEqualTo(target));
expect(rect.height, greaterThanOrEqualTo(target)); expect(rect.height, greaterThanOrEqualTo(target));
+40 -77
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
@@ -69,52 +68,28 @@ void main() {
testWidgets('320px at 2x text lays out without overflow', (tester) async { testWidgets('320px at 2x text lays out without overflow', (tester) async {
_size(tester, 320, scale: 2); _size(tester, 320, scale: 2);
for (final cupertino in [false, true]) { final bar = SegmentedBar(
final bar = SegmentedBar( cupertino: false,
cupertino: cupertino, leading: SegmentedBackButton(cupertino: false, onPressed: () {}),
leading: SegmentedBackButton(cupertino: cupertino, onPressed: () {}), title: 'A long conversation title',
title: 'A long conversation title', subtitle: 'a-working-folder',
subtitle: 'a-working-folder', subtitleIcon: Icons.folder_outlined,
subtitleIcon: Icons.folder_outlined, onTitlePressed: () {},
onTitlePressed: () {}, actions: [
actions: cupertino _modelAction('gpt-5.6-luna'),
? [ IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)),
CupertinoButton( ],
onPressed: () {}, );
child: const Text( await tester.pumpWidget(
'gpt-5.6-luna', MaterialApp(
maxLines: 1, home: Scaffold(
overflow: TextOverflow.ellipsis, extendBodyBehindAppBar: true,
), appBar: bar,
), body: const SizedBox.expand(),
] ),
: [ ),
_modelAction('gpt-5.6-luna'), );
IconButton(onPressed: () {}, icon: const Icon(Icons.refresh)), expect(tester.takeException(), isNull);
],
);
// A Cupertino bar over content (the conversation's own) scales its
// text; as a navigation bar the scaffold turns scaling off.
await tester.pumpWidget(
cupertino
? CupertinoApp(
home: CupertinoPageScaffold(
child: SegmentedBarOverlay(
bar: bar,
child: const SizedBox.expand(),
),
),
)
: MaterialApp(
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: const SizedBox.expand(),
),
),
);
expect(tester.takeException(), isNull, reason: 'cupertino: $cupertino');
}
}); });
testWidgets('taps between the pieces reach the content behind', ( testWidgets('taps between the pieces reach the content behind', (
@@ -173,48 +148,36 @@ void main() {
testWidgets('pieces are frosted glass, solid under high contrast', ( testWidgets('pieces are frosted glass, solid under high contrast', (
tester, tester,
) async { ) async {
Widget app(bool highContrast) => CupertinoApp( Widget app(bool highContrast) => MaterialApp(
home: MediaQuery( home: MediaQuery(
data: MediaQueryData(highContrast: highContrast), data: MediaQueryData(highContrast: highContrast),
child: const CupertinoPageScaffold( child: Scaffold(
navigationBar: SegmentedBar(cupertino: true, title: 'Glass'), appBar: const SegmentedBar(cupertino: false, title: 'Glass'),
child: SizedBox.expand(), body: const SizedBox.expand(),
), ),
), ),
); );
await tester.pumpWidget(app(false)); await tester.pumpWidget(app(false));
expect(find.byType(GlassPill), findsOneWidget); expect(find.byType(GlassPill), findsOneWidget);
expect(find.byType(BackdropFilter), findsOneWidget); expect(find.byType(BackdropFilter), findsOneWidget);
// The Cupertino bar draws no Material widget. expect(find.byType(Material), findsWidgets);
expect(find.byType(Material), findsNothing);
await tester.pumpWidget(app(true)); await tester.pumpWidget(app(true));
expect(find.byType(BackdropFilter), findsNothing); expect(find.byType(BackdropFilter), findsNothing);
}); });
testWidgets('Material and Cupertino titles use semibold text', ( testWidgets('Material titles use semibold text', (tester) async {
tester, await tester.pumpWidget(
) async { const MaterialApp(
for (final cupertino in [false, true]) { home: Scaffold(
await tester.pumpWidget( appBar: SegmentedBar(cupertino: false, title: 'Title'),
cupertino body: SizedBox.expand(),
? const CupertinoApp( ),
home: CupertinoPageScaffold( ),
navigationBar: SegmentedBar(cupertino: true, title: 'Title'), );
child: SizedBox.expand(), expect(
), tester.widget<Text>(find.text('Title')).style?.fontWeight,
) FontWeight.w600,
: const MaterialApp( );
home: Scaffold(
appBar: SegmentedBar(cupertino: false, title: 'Title'),
body: SizedBox.expand(),
),
),
);
expect(
tester.widget<Text>(find.text('Title')).style?.fontWeight,
FontWeight.w600,
);
}
}); });
} }
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart';
@@ -18,31 +17,22 @@ void main() {
const fieldKey = Key('field'); const fieldKey = Key('field');
Widget field(bool cupertino) => cupertino const field = TextField(key: fieldKey);
? const CupertinoTextField(key: fieldKey, placeholder: 'Find')
: const TextField(key: fieldKey);
Rect pillOf(WidgetTester tester, Finder child) => tester.getRect( Rect pillOf(WidgetTester tester, Finder child) => tester.getRect(
find.ancestor(of: child, matching: find.byType(GlassPill)).first, find.ancestor(of: child, matching: find.byType(GlassPill)).first,
); );
Widget page(bool cupertino, SegmentedBar bar) => cupertino Widget page(SegmentedBar bar) => MaterialApp(
? CupertinoApp( home: Scaffold(
home: CupertinoPageScaffold( extendBodyBehindAppBar: true,
navigationBar: bar, appBar: bar,
child: const SizedBox.expand(), body: const SizedBox.expand(),
), ),
) );
: MaterialApp(
home: Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: const SizedBox.expand(),
),
);
for (final cupertino in [false, true]) { {
final host = cupertino ? 'Cupertino' : 'Material'; const host = 'Material';
testWidgets('$host: the widget replaces the title and fills a phone bar', ( testWidgets('$host: the widget replaces the title and fills a phone bar', (
tester, tester,
@@ -50,11 +40,10 @@ void main() {
setSize(tester, 390); setSize(tester, 390);
await tester.pumpWidget( await tester.pumpWidget(
page( page(
cupertino,
SegmentedBar( SegmentedBar(
cupertino: cupertino, cupertino: false,
title: 'Search', title: 'Search',
titleWidget: field(cupertino), titleWidget: field,
titleWidgetMaxWidth: 840, titleWidgetMaxWidth: 840,
), ),
), ),
@@ -81,15 +70,11 @@ void main() {
setSize(tester, 1200); setSize(tester, 1200);
await tester.pumpWidget( await tester.pumpWidget(
page( page(
cupertino,
SegmentedBar( SegmentedBar(
cupertino: cupertino, cupertino: false,
title: 'Search', title: 'Search',
leading: SegmentedBackButton( leading: SegmentedBackButton(cupertino: false, onPressed: () {}),
cupertino: cupertino, titleWidget: field,
onPressed: () {},
),
titleWidget: field(cupertino),
titleWidgetMaxWidth: 600, titleWidgetMaxWidth: 600,
actions: const [Icon(Icons.info_outline, key: Key('action'))], actions: const [Icon(Icons.info_outline, key: Key('action'))],
), ),
+99
View File
@@ -0,0 +1,99 @@
import 'package:pipelines_app/core/api_gateway.dart';
/// Local-only catalogs for exercising all three header menus with `header=1`.
/// No provider or production permission setting is read or changed.
class ChatCatalogFixture {
static const models = <JsonMap>[
{'id': 'openai/gpt-6.1', 'provider': 'openai', 'name': 'GPT 6.1'},
{'id': 'openai/gpt-5.6-luna', 'provider': 'openai', 'name': 'Luna'},
];
static const modes = <JsonMap>[
{
'id': 'default',
'name': 'Ask for permission',
'description': 'Ask before actions that require approval.',
},
{
'id': 'plan',
'name': 'Plan only',
'description': 'Inspect and plan without applying changes.',
},
{
'id': 'auto',
'name': 'Auto approve',
'description': 'Fixture-only automatic approval mode.',
},
];
final Map<String, JsonMap> _model = {};
final Map<String, String> _mode = {};
JsonMap rowFields(String sessionId) {
final model = _model[sessionId] ?? models.first;
final mode = _mode[sessionId] ?? 'default';
return {
'model': model['id'],
'model_provider': model['provider'],
if (_model.containsKey(sessionId)) 'model_selection': 'next_turn',
'mode': mode,
'mode_name': modes.firstWhere((item) => item['id'] == mode)['name'],
};
}
JsonMap? reply(JsonMap request) {
switch (request['type']) {
case 'chat_models':
return {'type': 'chat_models', 'chat_models': models};
case 'chat_modes':
final body = request['chat_query'];
final session = body is Map ? '${body['session_id'] ?? ''}' : '';
return {
'type': 'chat_modes',
'chat_modes': modes,
'chat_mode': {'mode': rowFields(session)['mode']},
};
case 'chat_model':
final body = request['chat_model'];
if (body is! Map) return _invalid;
final session = '${body['session_id'] ?? ''}';
final model = models
.where(
(item) =>
item['id'] == body['model'] &&
item['provider'] == body['provider'],
)
.firstOrNull;
if (session.isEmpty || model == null) return _invalid;
_model[session] = model;
return {
'type': 'chat_model',
'chat_model': {
'session_id': session,
'provider': model['provider'],
'model': model['id'],
'selection': 'next_turn',
},
};
case 'chat_mode':
final body = request['chat_mode'];
if (body is! Map) return _invalid;
final session = '${body['session_id'] ?? ''}';
final mode = '${body['mode'] ?? ''}';
if (session.isEmpty || !modes.any((item) => item['id'] == mode)) {
return _invalid;
}
_mode[session] = mode;
return {
'type': 'chat_mode',
'chat_mode': {'session_id': session, 'mode': mode},
};
default:
return null;
}
}
static const _invalid = <String, dynamic>{
'type': 'error',
'error': 'Unknown chat catalog fixture selection.',
};
}
+7 -3
View File
@@ -23,6 +23,7 @@
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'chat_effort_fixture.dart'; import 'chat_effort_fixture.dart';
import 'chat_catalog_fixture.dart';
import 'chat_new_session_fixture.dart'; import 'chat_new_session_fixture.dart';
import 'chat_turn_diff_fixture.dart'; import 'chat_turn_diff_fixture.dart';
import 'chat_question_fixture.dart'; import 'chat_question_fixture.dart';
@@ -77,6 +78,7 @@ const _colorTitles = [
const _colorStarred = {0, 1, 3}; const _colorStarred = {0, 1, 3};
const _colorNames = ['teal', 'purple', null, 'amber', 'red', null, 'blue']; const _colorNames = ['teal', 'purple', null, 'amber', 'red', null, 'blue'];
final Map<String, String?> _pickedColors = {}; final Map<String, String?> _pickedColors = {};
final _chatCatalog = ChatCatalogFixture();
JsonMap _chatRow(int i) { JsonMap _chatRow(int i) {
final id = perfChatId(i); final id = perfChatId(i);
@@ -86,9 +88,7 @@ JsonMap _chatRow(int i) {
'title': 'Fixture chat ${i + 1}', 'title': 'Fixture chat ${i + 1}',
'directory': '/workspace/demo', 'directory': '/workspace/demo',
if (_params['header'] == '1') ...{ if (_params['header'] == '1') ...{
'model': 'openai/gpt-6.1', ..._chatCatalog.rowFields(id),
'mode': 'default',
'mode_name': 'Ask for permission',
...chatEffortRowFields(id), ...chatEffortRowFields(id),
}, },
// Server-shaped handoff facts (chat_sessions rows carry them). // Server-shaped handoff facts (chat_sessions rows carry them).
@@ -245,6 +245,10 @@ JsonMap? perfChatReply(JsonMap request) {
final shell = chatShellReply(request); final shell = chatShellReply(request);
if (shell != null) return shell; if (shell != null) return shell;
final id = request['id']; final id = request['id'];
if (_params['header'] == '1') {
final catalog = _chatCatalog.reply(request);
if (catalog != null) return {'id': id, ...catalog};
}
switch ('${request['type']}') { switch ('${request['type']}') {
case 'chat_effort': case 'chat_effort':
return {'id': id, ...chatEffortReply(request)}; return {'id': id, ...chatEffortReply(request)};