From 9adee6cc601048a6a986123197a6e458c6b9131a Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 02:41:26 +0000 Subject: [PATCH 1/4] Remove Cupertino UI branches Keep the public Cupertino-compatible parameters while retaining only the Material implementations and tests. The app is Material-only, so deleting unreachable Cupertino branches reduces dead code without changing the active path. --- app/lib/ui/input/app_search_field.dart | 42 +- .../ui/input/cupertino_web_search_field.dart | 115 ----- .../motion/container_transform_gestures.dart | 102 +--- .../ui/motion/container_transform_route.dart | 31 +- app/lib/ui/navigation/bar_icon_button.dart | 37 +- app/lib/ui/navigation/chevron_pager.dart | 25 +- app/lib/ui/theme/app_theme.dart | 16 - .../search_artifact_open_test.dart | 114 ++--- .../application/search_chat_open_test.dart | 176 ++++--- app/test/application/search_wiring_test.dart | 61 --- .../changes/diff_presentation_test.dart | 87 ++-- .../features/changes/visit_paging_test.dart | 77 +-- .../runs/ui/runs_list_widget_test.dart | 10 +- .../features/runs/ui/runs_toolbar_test.dart | 14 +- .../ui/list/schedules_behind_bar_test.dart | 105 ++--- .../ui/list/schedules_layout_test.dart | 107 ++--- .../ui/list/schedules_screen_test.dart | 86 ++-- .../ui/list/schedules_wide_test.dart | 76 ++- .../search/search_bar_layout_test.dart | 279 +++++------ .../search/search_chat_screen_test.dart | 105 ++--- .../features/search/search_screen_test.dart | 29 -- app/test/shell/search_escape_test.dart | 30 +- app/test/shell/search_shortcuts_test.dart | 55 --- app/test/ui/adaptive/glass_bar_test.dart | 438 ++++++++---------- .../cupertino_web_search_field_test.dart | 89 ---- .../container_transform_route_test.dart | 83 +--- .../ui/navigation/bar_icon_button_test.dart | 121 +++-- app/test/ui/theme/app_font_theme_test.dart | 90 ++-- app/test/ui/theme/app_theme_test.dart | 9 +- 29 files changed, 865 insertions(+), 1744 deletions(-) delete mode 100644 app/lib/ui/input/cupertino_web_search_field.dart delete mode 100644 app/test/ui/input/cupertino_web_search_field_test.dart diff --git a/app/lib/ui/input/app_search_field.dart b/app/lib/ui/input/app_search_field.dart index 1c6f3c12..050219bd 100644 --- a/app/lib/ui/input/app_search_field.dart +++ b/app/lib/ui/input/app_search_field.dart @@ -1,17 +1,11 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import '../adaptive/host.dart'; -import 'cupertino_web_search_field.dart'; - -/// The app's one search field per platform. +/// The app's one search field. /// -/// Cupertino uses the stock [CupertinoSearchTextField]. Material uses a -/// [TextField] shaped like it: a stadium with a leading search icon, a clear -/// button once there is text, no underline and no elevation. On a page it is -/// filled with the host's raised surface; [inBar] drops the fill (and the -/// Cupertino grey) because a bar's glass pill is already its background. +/// A [TextField] shaped like the stock iOS field: a stadium with a leading +/// search icon, a clear button once there is text, no underline and no +/// elevation. On a page it is filled with the host's raised surface; [inBar] +/// drops the fill because a bar's glass pill is already its background. class AppSearchField extends StatelessWidget { const AppSearchField({ super.key, @@ -58,32 +52,6 @@ class AppSearchField extends StatelessWidget { @override Widget build(BuildContext context) { - if (cupertino ?? usesCupertinoHost(context)) { - if (kIsWeb) { - return CupertinoWebSearchField( - controller: controller, - placeholder: placeholder, - fieldKey: fieldKey, - focusNode: focusNode, - autofocus: autofocus, - inBar: inBar, - onChanged: onChanged, - onSubmitted: onSubmitted, - onCleared: _clear, - ); - } - return CupertinoSearchTextField( - key: fieldKey, - controller: controller, - focusNode: focusNode, - autofocus: autofocus, - placeholder: placeholder, - backgroundColor: inBar ? const Color(0x00000000) : null, - onChanged: onChanged, - onSubmitted: onSubmitted, - onSuffixTap: _clear, - ); - } final scheme = Theme.of(context).colorScheme; const radius = BorderRadius.all(Radius.circular(28)); const stadium = OutlineInputBorder( diff --git a/app/lib/ui/input/cupertino_web_search_field.dart b/app/lib/ui/input/cupertino_web_search_field.dart deleted file mode 100644 index 740033a0..00000000 --- a/app/lib/ui/input/cupertino_web_search_field.dart +++ /dev/null @@ -1,115 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -/// Keeps the web input's semantics stable when its clear action appears. -/// Nesting the clear button in CupertinoSearchTextField changes its merged -/// editable node into a disabled child node on web. Native sibling controls -/// retain both an enabled input and an independently accessible clear action. -class CupertinoWebSearchField extends StatefulWidget { - const CupertinoWebSearchField({ - super.key, - required this.controller, - required this.placeholder, - required this.onCleared, - this.fieldKey, - this.focusNode, - this.autofocus = false, - this.inBar = false, - this.onChanged, - this.onSubmitted, - }); - - final TextEditingController controller; - final String placeholder; - final VoidCallback onCleared; - final Key? fieldKey; - final FocusNode? focusNode; - final bool autofocus; - final bool inBar; - final ValueChanged? onChanged; - final ValueChanged? onSubmitted; - - @override - State createState() => - _CupertinoWebSearchFieldState(); -} - -class _CupertinoWebSearchFieldState extends State { - FocusNode? _localFocus; - FocusNode get _focus => widget.focusNode ?? (_localFocus ??= FocusNode()); - - void _clear() { - final focus = _focus; - // The browser can keep the old editing session focused on the semantic - // clear button after it is removed. This explicit action ends that edit, - // then hands focus back after layout; ordinary query changes never refocus. - focus.unfocus(); - widget.onCleared(); - WidgetsBinding.instance.addPostFrameCallback((_) { - if (!mounted || !identical(focus, _focus)) return; - final current = FocusManager.instance.primaryFocus; - if (current == null || current == focus || current is FocusScopeNode) { - focus.requestFocus(); - } - }); - WidgetsBinding.instance.ensureVisualUpdate(); - } - - @override - void dispose() { - _localFocus?.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) => DecoratedBox( - decoration: BoxDecoration( - color: widget.inBar - ? const Color(0x00000000) - : CupertinoColors.tertiarySystemFill.resolveFrom(context), - borderRadius: BorderRadius.circular(9), - ), - child: ConstrainedBox( - constraints: const BoxConstraints( - minHeight: kMinInteractiveDimensionCupertino, - ), - child: TextFieldTapRegion( - child: Row( - children: [ - Expanded( - child: CupertinoSearchTextField( - key: widget.fieldKey, - controller: widget.controller, - focusNode: _focus, - autofocus: widget.autofocus, - placeholder: widget.placeholder, - backgroundColor: const Color(0x00000000), - suffixMode: OverlayVisibilityMode.never, - onChanged: widget.onChanged, - onSubmitted: widget.onSubmitted, - ), - ), - ValueListenableBuilder( - valueListenable: widget.controller, - builder: (context, value, _) => value.text.isEmpty - ? const SizedBox.shrink() - : CupertinoButton( - padding: const EdgeInsets.symmetric(horizontal: 8), - onPressed: _clear, - child: Icon( - CupertinoIcons.clear_thick_circled, - color: CupertinoColors.secondaryLabel.resolveFrom( - context, - ), - size: 20, - semanticLabel: CupertinoLocalizations.of( - context, - ).clearButtonLabel, - ), - ), - ), - ], - ), - ), - ), - ); -} diff --git a/app/lib/ui/motion/container_transform_gestures.dart b/app/lib/ui/motion/container_transform_gestures.dart index 5a4ff7a2..da0abd03 100644 --- a/app/lib/ui/motion/container_transform_gestures.dart +++ b/app/lib/ui/motion/container_transform_gestures.dart @@ -1,6 +1,3 @@ -import 'dart:math' as math; - -import 'package:flutter/gestures.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -21,10 +18,9 @@ abstract interface class ContainerTransformGestureRoute void endSwipeBack(double velocity); } -/// The back gestures of a page that shrinks into its item: on a Cupertino -/// host the native swipe from the start edge; on Android the system's -/// predictive back. Either one drives the page's own animation, so the -/// shrink follows the finger, and releasing commits or cancels it. +/// The back gestures of a page that shrinks into its item: the system's +/// predictive back drives the page's own animation, so the shrink follows +/// the finger, and releasing commits or cancels it. class ContainerTransformBackGestures extends StatelessWidget { const ContainerTransformBackGestures({ super.key, @@ -38,96 +34,8 @@ class ContainerTransformBackGestures extends StatelessWidget { final Widget child; @override - Widget build(BuildContext context) => cupertino - ? _EdgeSwipeBack(route: route, child: child) - : _PredictiveBack(route: route, child: child); -} - -/// The width of the start edge that takes a swipe back, as in iOS. -const double _edgeWidth = 20; - -class _EdgeSwipeBack extends StatefulWidget { - const _EdgeSwipeBack({required this.route, required this.child}); - - final ContainerTransformGestureRoute route; - final Widget child; - - @override - State<_EdgeSwipeBack> createState() => _EdgeSwipeBackState(); -} - -class _EdgeSwipeBackState extends State<_EdgeSwipeBack> { - late final HorizontalDragGestureRecognizer _recognizer = - HorizontalDragGestureRecognizer(debugOwner: this) - ..onStart = _start - ..onUpdate = _update - ..onEnd = _end - ..onCancel = _cancel; - bool _dragging = false; - - @override - void dispose() { - _recognizer.dispose(); - if (_dragging) widget.route.endSwipeBack(0); - super.dispose(); - } - - double _logical(double value) => - Directionality.of(context) == TextDirection.rtl ? -value : value; - - void _start(DragStartDetails details) { - _dragging = true; - widget.route.startSwipeBack(); - } - - void _update(DragUpdateDetails details) { - if (!_dragging) return; - widget.route.updateSwipeBack( - _logical(details.primaryDelta! / context.size!.width), - ); - } - - void _end(DragEndDetails details) { - if (!_dragging) return; - _dragging = false; - widget.route.endSwipeBack( - _logical(details.velocity.pixelsPerSecond.dx / context.size!.width), - ); - } - - void _cancel() { - if (!_dragging) return; - _dragging = false; - widget.route.endSwipeBack(0); - } - - @override - Widget build(BuildContext context) { - final padding = MediaQuery.paddingOf(context); - final notch = Directionality.of(context) == TextDirection.rtl - ? padding.right - : padding.left; - return Stack( - fit: StackFit.passthrough, - children: [ - widget.child, - PositionedDirectional( - start: 0, - top: 0, - bottom: 0, - width: math.max(notch, _edgeWidth), - child: Listener( - behavior: HitTestBehavior.translucent, - onPointerDown: (event) { - if (widget.route.backGestureEnabled) { - _recognizer.addPointer(event); - } - }, - ), - ), - ], - ); - } + Widget build(BuildContext context) => + _PredictiveBack(route: route, child: child); } /// Forwards Android's predictive back to the page, as the stock Material diff --git a/app/lib/ui/motion/container_transform_route.dart b/app/lib/ui/motion/container_transform_route.dart index 92e83fc4..d6bbb51f 100644 --- a/app/lib/ui/motion/container_transform_route.dart +++ b/app/lib/ui/motion/container_transform_route.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'container_transform_flight.dart'; @@ -15,10 +14,9 @@ const Duration _droppedSwipeDuration = Duration(milliseconds: 350); /// [link] resolves the item each time the page animates, so closing after /// another item took the page shrinks into that one. When the item is not on /// screen, or the system asks for reduced motion, the page fades instead. -/// The list behind stays put. A Cupertino host keeps the native swipe back -/// from the start edge and Android its predictive back; both drive the -/// shrink with the finger. The animation-speed setting scales every -/// duration through the scheduler clock. +/// The list behind stays put. Android's predictive back drives the shrink +/// with the finger. The animation-speed setting scales every duration +/// through the scheduler clock. class ContainerTransformPageRoute extends PageRoute implements ContainerTransformGestureRoute { ContainerTransformPageRoute({ @@ -81,33 +79,16 @@ class ContainerTransformPageRoute extends PageRoute Widget child, ) { final reduced = MediaQuery.maybeDisableAnimationsOf(context) ?? false; - final pageColor = cupertino - ? CupertinoDynamicColor.resolve( - CupertinoTheme.of(context).scaffoldBackgroundColor, - context, - ) - : Theme.of(context).scaffoldBackgroundColor; - Widget page = ContainerTransformFlight( + final page = ContainerTransformFlight( animation: animation, origin: reduced ? null : link.resolve, closing: () => animation.status == AnimationStatus.reverse || popGestureInProgress, tracking: () => popGestureInProgress, - pageColor: pageColor, - scrimColor: cupertino - ? CupertinoColors.black - : Theme.of(context).colorScheme.scrim, + pageColor: Theme.of(context).scaffoldBackgroundColor, + scrimColor: Theme.of(context).colorScheme.scrim, child: child, ); - if (cupertino) { - // A page pushed over this one keeps the native parallax. - page = CupertinoPageTransition( - primaryRouteAnimation: kAlwaysCompleteAnimation, - secondaryRouteAnimation: secondaryAnimation, - linearTransition: popGestureInProgress, - child: page, - ); - } return ContainerTransformBackGestures( route: this, cupertino: cupertino, diff --git a/app/lib/ui/navigation/bar_icon_button.dart b/app/lib/ui/navigation/bar_icon_button.dart index 1c33e8a1..086e6fe7 100644 --- a/app/lib/ui/navigation/bar_icon_button.dart +++ b/app/lib/ui/navigation/bar_icon_button.dart @@ -1,14 +1,10 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../adaptive/host.dart'; - /// One icon action of a segmented bar's actions pill (or any toolbar row). /// /// Every action gets the platform's whole touch target and no extra padding, /// so a row of them is evenly spaced and the last one never touches the -/// pill's edge: Material's [IconButton] (48dp, with its tooltip), Cupertino's -/// [CupertinoButton] at [kMinInteractiveDimensionCupertino] (44pt) square. +/// pill's edge: Material's [IconButton] (48dp, with its tooltip). /// While [busy] the action shows the platform's activity indicator in the /// same box and takes no taps. class BarIconButton extends StatelessWidget { @@ -43,40 +39,21 @@ class BarIconButton extends StatelessWidget { @override Widget build(BuildContext context) { - final native = cupertino ?? usesCupertinoHost(context); if (busy) { - final side = native - ? kMinInteractiveDimensionCupertino - : kMinInteractiveDimension; return Semantics( label: busyLabel ?? label, liveRegion: true, - child: SizedBox.square( - dimension: side, + child: const SizedBox.square( + dimension: kMinInteractiveDimension, child: Center( - child: native - ? const CupertinoActivityIndicator() - : const SizedBox.square( - dimension: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ), + child: SizedBox.square( + dimension: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ), ), ), ); } - if (native) { - return Semantics( - button: true, - label: label, - excludeSemantics: true, - child: CupertinoButton( - padding: EdgeInsets.zero, - minimumSize: const Size.square(kMinInteractiveDimensionCupertino), - onPressed: onPressed, - child: Icon(cupertinoIcon), - ), - ); - } return IconButton( tooltip: label, isSelected: selected, diff --git a/app/lib/ui/navigation/chevron_pager.dart b/app/lib/ui/navigation/chevron_pager.dart index c96a1fc4..0cf39128 100644 --- a/app/lib/ui/navigation/chevron_pager.dart +++ b/app/lib/ui/navigation/chevron_pager.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../adaptive/glass_bar.dart'; -import '../adaptive/host.dart'; /// Previous and next as chevrons in one row at the bottom right, with the /// position before them (`2 of 5`). Each chevron is named for assistive @@ -34,33 +32,12 @@ class ChevronPager extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); Widget chevron({ required Key? key, required bool previous, required String label, required VoidCallback? onPressed, }) { - if (cupertino) { - return Semantics( - button: true, - enabled: onPressed != null, - label: label, - excludeSemantics: true, - child: CupertinoButton( - key: key, - padding: EdgeInsets.zero, - minimumSize: GlassBarMetrics.cupertinoMinimumSize(), - onPressed: onPressed, - child: Icon( - previous - ? CupertinoIcons.chevron_left - : CupertinoIcons.chevron_right, - size: GlassBarMetrics.iconSize(true), - ), - ), - ); - } return IconButton( key: key, tooltip: label, @@ -77,7 +54,7 @@ class ChevronPager extends StatelessWidget { // The surrounding glass bar supplies the edge gap ([GlassBarMetrics]). // The position keeps an icon's inset on each side, so it sits as far from // the bar's edge and from the chevrons as an icon would. - final inset = GlassBarMetrics.iconInset(cupertino); + final inset = GlassBarMetrics.iconInset(false); return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/app/lib/ui/theme/app_theme.dart b/app/lib/ui/theme/app_theme.dart index 40ad5587..adfca7fa 100644 --- a/app/lib/ui/theme/app_theme.dart +++ b/app/lib/ui/theme/app_theme.dart @@ -37,7 +37,6 @@ ThemeData appLightTheme({String? fontFamily}) { colorScheme: scheme, pageTransitionsTheme: appPageTransitions, fontFamily: fontFamily, - cupertinoOverrideTheme: _cupertinoOverride(fontFamily, scheme), ); } @@ -110,7 +109,6 @@ ThemeData appDarkTheme({String? fontFamily}) { scaffoldBackgroundColor: scheme.surface, pageTransitionsTheme: appPageTransitions, fontFamily: fontFamily, - cupertinoOverrideTheme: _cupertinoOverride(fontFamily, scheme), ); } @@ -146,17 +144,3 @@ CupertinoTextThemeData appCupertinoTextTheme( dateTimePickerTextStyle: face(base.dateTimePickerTextStyle), ); } - -/// Cupertino widgets on a Material host derive their theme from Material's; -/// only the family is overridden, with Material's primary for actions. -NoDefaultCupertinoThemeData? _cupertinoOverride( - String? fontFamily, - ColorScheme scheme, -) => fontFamily == null - ? null - : CupertinoThemeData( - textTheme: appCupertinoTextTheme( - fontFamily, - primaryColor: scheme.primary, - ), - ); diff --git a/app/test/application/search_artifact_open_test.dart b/app/test/application/search_artifact_open_test.dart index 49b15a9d..478660b1 100644 --- a/app/test/application/search_artifact_open_test.dart +++ b/app/test/application/search_artifact_open_test.dart @@ -26,9 +26,8 @@ import 'search_wiring_test.dart' void main() { Future openPhoneApp( WidgetTester tester, - FakeChannel channel, { - required bool cupertino, - }) async { + FakeChannel channel, + ) async { tester.view.physicalSize = const Size(390, 844); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); @@ -42,77 +41,66 @@ void main() { channel: channel, client: PipelinesClient(channelFactory: (_) => channel), provider: provider, - cupertino: cupertino, + cupertino: false, ); await replyRunList(tester, channel); return provider; } - for (final cupertino in [false, true]) { - final platform = cupertino ? 'Cupertino' : 'Material'; + testWidgets('phone: an artifact hit opens that artifact in the ' + 'viewer, and Back shows it on the run Artifacts tab', (tester) async { + final channel = FakeChannel()..readyCompleter.complete(); + final provider = await openPhoneApp(tester, channel); - testWidgets('$platform phone: an artifact hit opens that artifact in the ' - 'viewer, and Back shows it on the run Artifacts tab', (tester) async { - final channel = FakeChannel()..readyCompleter.complete(); - final provider = await openPhoneApp( - tester, - channel, - cupertino: cupertino, - ); + await openArtifactHit(tester, channel); + expect(provider.value.uri.path, '/runs/7'); + await replyRunDetailFor(tester, channel, searchSelectionDetail()); + await tester.pumpAndSettle(); - await openArtifactHit(tester, channel); - expect(provider.value.uri.path, '/runs/7'); - await replyRunDetailFor(tester, channel, searchSelectionDetail()); - await tester.pumpAndSettle(); + expect(find.byType(SearchScreen), findsNothing); + final viewer = tester.widget( + find.byType(ArtifactViewerPage), + ); + expect(viewer.selectedIdentity, contains('report.txt')); + expect(find.text('report.txt'), findsWidgets); - expect(find.byType(SearchScreen), findsNothing); - final viewer = tester.widget( - find.byType(ArtifactViewerPage), - ); - expect(viewer.selectedIdentity, contains('report.txt')); - expect(find.text('report.txt'), findsWidgets); + await closeViewer(tester); + expectArtifactsTabSelecting(tester, '/artifacts/7/2/report.txt'); - await closeViewer(tester); - expectArtifactsTabSelecting(tester, '/artifacts/7/2/report.txt'); + await tester.pumpWidget(const SizedBox.shrink()); + await tester.pump(); + }); - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); - }); + testWidgets('phone: an artifact the run no longer lists opens ' + 'its Artifacts tab with a notice', (tester) async { + final channel = FakeChannel()..readyCompleter.complete(); + await openPhoneApp(tester, channel); - testWidgets('$platform phone: an artifact the run no longer lists opens ' - 'its Artifacts tab with a notice', (tester) async { - final channel = FakeChannel()..readyCompleter.complete(); - await openPhoneApp(tester, channel, cupertino: cupertino); + await openArtifactHit(tester, channel); + final detail = searchSelectionDetail(); + final steps = [ + for (final step in detail['steps'] as List) + Map.from(step as Map), + ]; + steps[1]['artifacts'] = [ + { + 'name': 'other.txt', + 'content_type': 'text/plain', + 'size_bytes': 3, + 'url': '/artifacts/7/2/other.txt', + }, + ]; + await replyRunDetailFor(tester, channel, {...detail, 'steps': steps}); + await tester.pumpAndSettle(); - await openArtifactHit(tester, channel); - final detail = searchSelectionDetail(); - final steps = [ - for (final step in detail['steps'] as List) - Map.from(step as Map), - ]; - steps[1]['artifacts'] = [ - { - 'name': 'other.txt', - 'content_type': 'text/plain', - 'size_bytes': 3, - 'url': '/artifacts/7/2/other.txt', - }, - ]; - await replyRunDetailFor(tester, channel, {...detail, 'steps': steps}); - await tester.pumpAndSettle(); + expect(find.byType(ArtifactViewerPage), findsNothing); + expect( + find.byKey(const ValueKey('run-detail-artifacts-7')), + findsOneWidget, + ); + expect(find.text('That artifact is no longer available.'), findsOneWidget); - expect(find.byType(ArtifactViewerPage), findsNothing); - expect( - find.byKey(const ValueKey('run-detail-artifacts-7')), - findsOneWidget, - ); - expect( - find.text('That artifact is no longer available.'), - findsOneWidget, - ); - - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); - }); - } + await tester.pumpWidget(const SizedBox.shrink()); + await tester.pump(); + }); } diff --git a/app/test/application/search_chat_open_test.dart b/app/test/application/search_chat_open_test.dart index aee27d72..8b443eb2 100644 --- a/app/test/application/search_chat_open_test.dart +++ b/app/test/application/search_chat_open_test.dart @@ -30,102 +30,96 @@ Map _results(String kind, List> hits) => { /// chat search the app sends after it, then a tap on the chat hit opens that /// chat in the Chat tab with its session selected. void main() { - for (final cupertino in [false, true]) { - testWidgets('${cupertino ? 'Cupertino' : 'Material'}: a chat hit opens ' - 'its chat in the Chat tab', (tester) async { - tester.view.physicalSize = const Size(900, 1000); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); - final channel = FakeChannel()..readyCompleter.complete(); - final provider = PlatformRouteInformationProvider( - initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')), - ); - addTearDown(provider.dispose); - await pumpApp( - tester, - channel: channel, - client: PipelinesClient(channelFactory: (_) => channel), - provider: provider, - cupertino: cupertino, - ); - await replyRunList(tester, channel); + testWidgets('a chat hit opens its chat in the Chat tab', (tester) async { + tester.view.physicalSize = const Size(900, 1000); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); + final channel = FakeChannel()..readyCompleter.complete(); + final provider = PlatformRouteInformationProvider( + initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')), + ); + addTearDown(provider.dispose); + await pumpApp( + tester, + channel: channel, + client: PipelinesClient(channelFactory: (_) => channel), + provider: provider, + cupertino: false, + ); + await replyRunList(tester, channel); - await tapTab(tester, 'Search'); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 600)); - await tester.pump(const Duration(milliseconds: 100)); - await tester.enterText( - find.byKey(const ValueKey('search.field')), - 'flaky', - ); - await tester.pump(const Duration(milliseconds: 300)); + await tapTab(tester, 'Search'); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 600)); + await tester.pump(const Duration(milliseconds: 100)); + await tester.enterText(find.byKey(const ValueKey('search.field')), 'flaky'); + await tester.pump(const Duration(milliseconds: 300)); - final runs = await waitForSearch(tester, channel); - channel.incoming.add(jsonEncode({'id': runs['id'], ..._results('', [])})); - await tester.pump(); - await tester.pump(); - final chats = await waitForSearch(tester, channel, chats: true); - expect(chats['search'], {'query': 'flaky', 'kind': 'chat', 'limit': 0}); - channel.incoming.add( - jsonEncode({ - 'id': chats['id'], - ..._results('chat', [ - { - 'kind': 'chat', - 'target': 'chat:$_session', - 'score': 1, - 'matched_field': 'message', - 'chat': { - 'session_id': _session, - 'title': 'Fix CI', - 'directory': '/work/api', - 'backend': 'claude', - 'message_id': 'm2', - 'snippet': 'the flaky retry loop', - }, - }, - ]), - }), - ); - await tester.pump(); - await tester.pump(); - expect(find.text('Chats (1)'), findsOneWidget); - expect(find.textContaining('the flaky retry loop'), findsOneWidget); - - await tester.tap( - find.byKey(const ValueKey('search.result.chat:$_session')), - ); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 400)); - await tester.pump(const Duration(milliseconds: 400)); - - expect(provider.value.uri.path, '/chat/$_session'); - expect(find.byType(SearchScreen), findsNothing); - final screen = tester.widget(find.byType(ChatScreen)); - expect(screen.initialSessionId, _session); - - await reply( - tester, - channel, - 'chat_sessions', - body: { - 'type': 'chat_sessions', - 'chat_sessions': [ - { - 'id': _session, + final runs = await waitForSearch(tester, channel); + channel.incoming.add(jsonEncode({'id': runs['id'], ..._results('', [])})); + await tester.pump(); + await tester.pump(); + final chats = await waitForSearch(tester, channel, chats: true); + expect(chats['search'], {'query': 'flaky', 'kind': 'chat', 'limit': 0}); + channel.incoming.add( + jsonEncode({ + 'id': chats['id'], + ..._results('chat', [ + { + 'kind': 'chat', + 'target': 'chat:$_session', + 'score': 1, + 'matched_field': 'message', + 'chat': { + 'session_id': _session, 'title': 'Fix CI', 'directory': '/work/api', 'backend': 'claude', + 'message_id': 'm2', + 'snippet': 'the flaky retry loop', }, - ], - }, - ); - await tester.pump(const Duration(milliseconds: 400)); - expect(find.text('Fix CI'), findsWidgets); + }, + ]), + }), + ); + await tester.pump(); + await tester.pump(); + expect(find.text('Chats (1)'), findsOneWidget); + expect(find.textContaining('the flaky retry loop'), findsOneWidget); - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); - }); - } + await tester.tap( + find.byKey(const ValueKey('search.result.chat:$_session')), + ); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 400)); + await tester.pump(const Duration(milliseconds: 400)); + + expect(provider.value.uri.path, '/chat/$_session'); + expect(find.byType(SearchScreen), findsNothing); + final screen = tester.widget(find.byType(ChatScreen)); + expect(screen.initialSessionId, _session); + + await reply( + tester, + channel, + 'chat_sessions', + body: { + 'type': 'chat_sessions', + 'chat_sessions': [ + { + 'id': _session, + 'title': 'Fix CI', + 'directory': '/work/api', + 'backend': 'claude', + }, + ], + }, + ); + await tester.pump(const Duration(milliseconds: 400)); + expect(find.text('Fix CI'), findsWidgets); + + await tester.pumpWidget(const SizedBox.shrink()); + await tester.pump(); + }); } diff --git a/app/test/application/search_wiring_test.dart b/app/test/application/search_wiring_test.dart index 9b51f2aa..9ec6e1fb 100644 --- a/app/test/application/search_wiring_test.dart +++ b/app/test/application/search_wiring_test.dart @@ -801,67 +801,6 @@ void main() { await tester.pump(); }); - testWidgets('Cupertino Search is a native tab', (tester) async { - tester.view.physicalSize = const Size(390, 844); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); - tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark; - addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue); - - final channel = FakeChannel()..readyCompleter.complete(); - var sockets = 0; - final client = PipelinesClient( - channelFactory: (_) { - sockets++; - return channel; - }, - ); - final provider = PlatformRouteInformationProvider( - initialRouteInformation: RouteInformation(uri: Uri.parse('/runs')), - ); - addTearDown(provider.dispose); - - await pumpApp( - tester, - channel: channel, - client: client, - provider: provider, - cupertino: true, - ); - await replyRunList(tester, channel); - expect(find.text('Preserved run'), findsWidgets); - - await tapTab(tester, 'Search'); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 600)); - await tester.pump(const Duration(milliseconds: 100)); - - expect(provider.value.uri.path, '/search'); - expect(find.byKey(const ValueKey('search.field')), findsOneWidget); - expect(find.byType(Material), findsNothing); - final cupertinoField = tester.widget( - find.descendant( - of: find.byKey(const ValueKey('search.field')), - matching: find.byType(EditableText), - ), - ); - expect(cupertinoField.focusNode.hasFocus, isTrue); - - await tapTab(tester, 'Runs'); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 400)); - await tester.pump(const Duration(milliseconds: 400)); - - expect(provider.value.uri.path, '/runs'); - expect(find.byKey(const ValueKey('search.field')), findsNothing); - expect(find.text('Preserved run'), findsWidgets); - expect(sockets, 1); - - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); - }); - test( 'the hit helper never guesses a route for pipeline or malformed hits', () { diff --git a/app/test/features/changes/diff_presentation_test.dart b/app/test/features/changes/diff_presentation_test.dart index be4b7c85..5ba45620 100644 --- a/app/test/features/changes/diff_presentation_test.dart +++ b/app/test/features/changes/diff_presentation_test.dart @@ -294,59 +294,46 @@ void main() { expect(tester.takeException(), isNull); }); - for (final cupertino in [false, true]) { - testWidgets('a file opens as a page that steps to the previous and next ' - 'file (${cupertino ? 'cupertino' : 'material'})', (tester) async { - tester.view.physicalSize = const Size(390, 844); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - final viewer = ChangesViewer( - steps: [ - stepFixture( - fileChanges: captureFixture( - files: [ - fileChangeFixture( - path: 'lib/first.dart', - patch: multiHunkPatch, - ), - fileChangeFixture( - path: 'lib/second.dart', - patch: multiHunkPatch, - ), - ], - ), + testWidgets('a file opens as a page that steps to the previous and next ' + 'file', (tester) async { + tester.view.physicalSize = const Size(390, 844); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final viewer = ChangesViewer( + steps: [ + stepFixture( + fileChanges: captureFixture( + files: [ + fileChangeFixture(path: 'lib/first.dart', patch: multiHunkPatch), + fileChangeFixture(path: 'lib/second.dart', patch: multiHunkPatch), + ], ), - ], - ); - await tester.pumpWidget( - cupertino ? cupertinoHost(viewer) : materialHost(viewer), - ); - await tester.tap(find.byKey(const ValueKey('change-1-lib/first.dart'))); - await tester.pumpAndSettle(); + ), + ], + ); + await tester.pumpWidget(materialHost(viewer)); + await tester.tap(find.byKey(const ValueKey('change-1-lib/first.dart'))); + await tester.pumpAndSettle(); - Finder control(String label) => - cupertino ? find.bySemanticsLabel(label) : find.byTooltip(label); - expect(find.byType(FileDiffPage), findsOneWidget); - expect(find.text('first.dart'), findsOneWidget); - expect(find.text('1 of 2'), findsOneWidget); - // The pager sits at the bottom right. - final pager = tester.getRect( - find.byKey(const ValueKey('file-diff-pager')), - ); - expect(pager.bottom, greaterThan(844 - 120)); - final next = tester.getRect(control('Next file')); - expect(next.right, greaterThan(390 - 80)); + Finder control(String label) => find.byTooltip(label); + expect(find.byType(FileDiffPage), findsOneWidget); + expect(find.text('first.dart'), findsOneWidget); + expect(find.text('1 of 2'), findsOneWidget); + // The pager sits at the bottom right. + final pager = tester.getRect(find.byKey(const ValueKey('file-diff-pager'))); + expect(pager.bottom, greaterThan(844 - 120)); + final next = tester.getRect(control('Next file')); + expect(next.right, greaterThan(390 - 80)); - await tester.tap(control('Next file')); - await tester.pumpAndSettle(); - expect(find.text('second.dart'), findsOneWidget); - expect(find.text('2 of 2'), findsOneWidget); - await tester.tap(control('Previous file')); - await tester.pumpAndSettle(); - expect(find.text('first.dart'), findsOneWidget); - expect(tester.takeException(), isNull); - }); - } + await tester.tap(control('Next file')); + await tester.pumpAndSettle(); + expect(find.text('second.dart'), findsOneWidget); + expect(find.text('2 of 2'), findsOneWidget); + await tester.tap(control('Previous file')); + await tester.pumpAndSettle(); + expect(find.text('first.dart'), findsOneWidget); + expect(tester.takeException(), isNull); + }); final diffFile = FileChange( path: 'lib/feature.dart', diff --git a/app/test/features/changes/visit_paging_test.dart b/app/test/features/changes/visit_paging_test.dart index b8013e7c..c362b569 100644 --- a/app/test/features/changes/visit_paging_test.dart +++ b/app/test/features/changes/visit_paging_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -85,33 +84,28 @@ void main() { expect(next.bottom, greaterThan(844 - 80)); }); - for (final host in ['Material', 'Cupertino']) { - for (final size in [ - const Size(390, 844), - const Size(880, 1000), - const Size(1100, 800), - ]) { - testWidgets('$host pager clears an inherited stacked bar at $size', ( - tester, - ) async { - tester.view.physicalSize = size; - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - final child = ChangesViewer(steps: twoVisitRun()); - final hosted = host == 'Material' - ? materialHost(child) - : cupertinoHost(child); - await tester.pumpWidget( - MediaQuery( - data: const MediaQueryData(padding: EdgeInsets.only(bottom: 120)), - child: hosted, - ), - ); - await tester.pump(); - final pager = tester.getRect(find.byKey(ChangesVisitPager.nextKey)); - expect(pager.bottom, lessThanOrEqualTo(size.height - 120)); - }); - } + for (final size in [ + const Size(390, 844), + const Size(880, 1000), + const Size(1100, 800), + ]) { + testWidgets('Material pager clears an inherited stacked bar at $size', ( + tester, + ) async { + tester.view.physicalSize = size; + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final child = ChangesViewer(steps: twoVisitRun()); + await tester.pumpWidget( + MediaQuery( + data: const MediaQueryData(padding: EdgeInsets.only(bottom: 120)), + child: materialHost(child), + ), + ); + await tester.pump(); + final pager = tester.getRect(find.byKey(ChangesVisitPager.nextKey)); + expect(pager.bottom, lessThanOrEqualTo(size.height - 120)); + }); } testWidgets('paging stops at both ends instead of wrapping', (tester) async { @@ -220,31 +214,4 @@ void main() { expect(find.text('Visit 1 · completed'), findsOneWidget); expect(find.text('lib/c.dart'), findsOneWidget); }); - - testWidgets('Cupertino pages with native buttons at both ends', ( - tester, - ) async { - await tester.pumpWidget(cupertinoHost(ChangesViewer(steps: twoVisitRun()))); - - final previous = tester.widget( - find.byKey(ChangesVisitPager.previousKey), - ); - final next = tester.widget( - find.byKey(ChangesVisitPager.nextKey), - ); - expect(previous.onPressed, isNull); - expect(next.onPressed, isNotNull); - expect(find.byKey(ChangesVisitPager.previousKey), findsOneWidget); - expect(find.byKey(ChangesVisitPager.nextKey), findsOneWidget); - - await tester.tap(find.byKey(ChangesVisitPager.nextKey)); - await tester.pump(); - expect(find.text('reviewer'), findsNothing); - expect( - tester - .widget(find.byKey(ChangesVisitPager.nextKey)) - .onPressed, - isNull, - ); - }); } diff --git a/app/test/features/runs/ui/runs_list_widget_test.dart b/app/test/features/runs/ui/runs_list_widget_test.dart index e44ad309..43a2bcd0 100644 --- a/app/test/features/runs/ui/runs_list_widget_test.dart +++ b/app/test/features/runs/ui/runs_list_widget_test.dart @@ -68,21 +68,21 @@ void main() { } testWidgets( - 'uses native search and filters runs in CupertinoApp', + 'the filter sheet searches and filters runs', (tester) async { num? selectedRun; await mount( tester, - cupertino: true, + cupertino: false, onSelected: (id) => selectedRun = id, ); // The text filter lives in the filter sheet. - expect(find.byType(CupertinoSearchTextField), findsNothing); + expect(find.byType(TextField), findsNothing); expect(find.text('Alpha'), findsOneWidget); await tester.tap(find.byKey(const ValueKey('runs.filter'))); await tester.pumpAndSettle(); - await tester.enterText(find.byType(CupertinoSearchTextField), 'Beta'); + await tester.enterText(find.byType(TextField), 'Beta'); await tester.pumpAndSettle(); await tester.tapAt(const Offset(4, 4)); await tester.pumpAndSettle(); @@ -90,7 +90,7 @@ void main() { await tester.tap(find.byKey(const ValueKey('run-row-2'))); expect(selectedRun, 2); }, - variant: TargetPlatformVariant.only(TargetPlatform.iOS), + variant: TargetPlatformVariant.only(TargetPlatform.android), ); testWidgets( diff --git a/app/test/features/runs/ui/runs_toolbar_test.dart b/app/test/features/runs/ui/runs_toolbar_test.dart index ad12bd07..0e7dd5a8 100644 --- a/app/test/features/runs/ui/runs_toolbar_test.dart +++ b/app/test/features/runs/ui/runs_toolbar_test.dart @@ -146,13 +146,13 @@ void main() { ); testWidgets( - 'cupertino: the filter sheet filters and its chip clears the facet', + 'the filter sheet filters and its chip clears the facet', (tester) async { - await mount(tester, cupertino: true); + await mount(tester, cupertino: false); await tester.tap(find.byKey(const ValueKey('runs.filter'))); await tester.pumpAndSettle(); - expect(find.byType(CupertinoSearchTextField), findsOneWidget); - final failed = find.widgetWithText(CupertinoListTile, 'Failed'); + expect(find.byType(TextField), findsOneWidget); + final failed = find.widgetWithText(ListTile, 'Failed'); await reveal(tester, failed); await tester.pumpAndSettle(); await tester.tap(failed); @@ -160,10 +160,12 @@ void main() { expect(controller.statuses, {'failed'}); await closeSheet(tester); - final failedChip = find.widgetWithText(CupertinoButton, 'Failed'); + final failedChip = find.widgetWithText(InputChip, 'Failed'); expect(failedChip, findsOneWidget); expect(find.text('Alpha'), findsNothing); - await tester.tap(failedChip); + await tester.tap( + find.descendant(of: failedChip, matching: find.byType(Tooltip)), + ); await tester.pumpAndSettle(); expect(controller.statuses, isEmpty); expect(find.text('Alpha'), findsOneWidget); diff --git a/app/test/features/schedules/ui/list/schedules_behind_bar_test.dart b/app/test/features/schedules/ui/list/schedules_behind_bar_test.dart index 71ca8abe..2aef251a 100644 --- a/app/test/features/schedules/ui/list/schedules_behind_bar_test.dart +++ b/app/test/features/schedules/ui/list/schedules_behind_bar_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/schedules/screen.dart'; @@ -12,7 +11,7 @@ import 'schedule_list_test_support.dart'; /// The schedule list under a floating bar: search, filter and count are a /// glass strip under the bar, and the list scrolls behind both. void main() { - Future pump(WidgetTester tester, {required bool cupertino}) async { + Future pump(WidgetTester tester) async { tester.view.physicalSize = const Size(390, 844); tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); @@ -20,19 +19,15 @@ void main() { (type, fields) async => schedulesReply(longScheduleList(30)), ); final screen = SchedulesScreen(gateway: gateway, onOpen: (_) {}); - final bar = SegmentedBar(cupertino: cupertino, title: 'Schedules'); + final bar = const SegmentedBar(cupertino: false, title: 'Schedules'); await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold(navigationBar: bar, child: screen), - ) - : MaterialApp( - home: Scaffold( - extendBodyBehindAppBar: true, - appBar: bar, - body: screen, - ), - ), + MaterialApp( + home: Scaffold( + extendBodyBehindAppBar: true, + appBar: bar, + body: screen, + ), + ), ); await tester.pumpAndSettle(); } @@ -41,53 +36,47 @@ void main() { find.descendant(of: owner, matching: find.byType(GlassPill)).first, ); - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; + testWidgets('the toolbar floats under the bar and the list ' + 'scrolls behind it', (tester) async { + await pump(tester); - testWidgets('$host: the toolbar floats under the bar and the list ' - 'scrolls behind it', (tester) async { - await pump(tester, cupertino: cupertino); + final bar = pieceOf(tester, find.byType(SegmentedBar)); + final strip = pieceOf(tester, find.byKey(scheduleToolbarKey)); + expect(strip.top, greaterThanOrEqualTo(bar.bottom)); + expect(strip.top - bar.bottom, lessThan(24)); + expect( + find.descendant( + of: find.byKey(scheduleToolbarKey), + matching: find.byKey(scheduleSearchFieldKey), + ), + findsOneWidget, + ); - final bar = pieceOf(tester, find.byType(SegmentedBar)); - final strip = pieceOf(tester, find.byKey(scheduleToolbarKey)); - expect(strip.top, greaterThanOrEqualTo(bar.bottom)); - expect(strip.top - bar.bottom, lessThan(24)); - expect( - find.descendant( - of: find.byKey(scheduleToolbarKey), - matching: find.byKey(scheduleSearchFieldKey), - ), - findsOneWidget, - ); + final list = find.byKey(scheduleListKey); + expect(tester.getTopLeft(list).dy, 0); + final firstRow = find.byKey(const ValueKey('schedule-row-0-100')); + final rest = tester.getTopLeft(firstRow).dy; + expect(rest, greaterThanOrEqualTo(strip.bottom)); - final list = find.byKey(scheduleListKey); - expect(tester.getTopLeft(list).dy, 0); - final firstRow = find.byKey(const ValueKey('schedule-row-0-100')); - final rest = tester.getTopLeft(firstRow).dy; - expect(rest, greaterThanOrEqualTo(strip.bottom)); + await tester.drag(list, const Offset(0, -120)); + await tester.pump(); + expect(tester.getTopLeft(firstRow).dy, lessThan(strip.bottom)); + }); - await tester.drag(list, const Offset(0, -120)); - await tester.pump(); - expect(tester.getTopLeft(firstRow).dy, lessThan(strip.bottom)); - }); + testWidgets('a query that empties the list keeps the field', (tester) async { + await pump(tester); + final field = find.byKey(scheduleSearchFieldKey); + await tester.tap(field); + await tester.pump(); + final before = tester.element(field); + await tester.enterText(field, 'no schedule matches this'); + await tester.pump(); - testWidgets('$host: a query that empties the list keeps the field', ( - tester, - ) async { - await pump(tester, cupertino: cupertino); - final field = find.byKey(scheduleSearchFieldKey); - await tester.tap(field); - await tester.pump(); - final before = tester.element(field); - await tester.enterText(field, 'no schedule matches this'); - await tester.pump(); - - expect(find.text('No schedules match this search.'), findsOneWidget); - expect(tester.element(field), same(before)); - final editable = tester.state( - find.descendant(of: field, matching: find.byType(EditableText)), - ); - expect(editable.widget.focusNode.hasFocus, isTrue); - }); - } + expect(find.text('No schedules match this search.'), findsOneWidget); + expect(tester.element(field), same(before)); + final editable = tester.state( + find.descendant(of: field, matching: find.byType(EditableText)), + ); + expect(editable.widget.focusNode.hasFocus, isTrue); + }); } diff --git a/app/test/features/schedules/ui/list/schedules_layout_test.dart b/app/test/features/schedules/ui/list/schedules_layout_test.dart index 1b98a8d5..c4ebbe2b 100644 --- a/app/test/features/schedules/ui/list/schedules_layout_test.dart +++ b/app/test/features/schedules/ui/list/schedules_layout_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/schedules/ui/list/schedule_list_controller.dart'; @@ -9,69 +8,55 @@ import 'schedule_list_test_support.dart'; import 'schedule_screen_harness.dart'; void main() { - for (final cupertino in [false, true]) { - for (final textScale in [1.0, 2.0]) { - testWidgets('${cupertino ? 'Cupertino' : 'Material'} list at 390px and ' - '${textScale}x text shows server values with native controls', ( + for (final textScale in [1.0, 2.0]) { + testWidgets('list at 390px and ${textScale}x text shows server values with ' + 'standard controls', (tester) async { + final gateway = FakeSchedulesGateway( + (type, fields) async => schedulesReply([ + scheduleRecord(nextDue: '2026-10-22T09:00:00'), + pausedRecord(), + ]), + ); + await pumpSchedules( tester, - ) async { - final gateway = FakeSchedulesGateway( - (type, fields) async => schedulesReply([ - scheduleRecord(nextDue: '2026-10-22T09:00:00'), - pausedRecord(), - ]), - ); - await pumpSchedules( - tester, - cupertino: cupertino, - gateway: gateway, - textScale: textScale, - ); + cupertino: false, + gateway: gateway, + textScale: textScale, + ); - expect(find.text('2 schedules'), findsOneWidget); - // The strip carries the count only; the helper line lives in the - // empty state. - expect(find.textContaining('not pipeline definitions'), findsNothing); - // Two lines per row: the name with its next run, then the timer - // and pinned pipeline version. The editor holds the rest. - expect(find.text('Research batteries'), findsOneWidget); - expect(find.text('22 Oct'), findsOneWidget); - expect( - find.text('Every 24h · mon, wed · Pipeline 4 · v2'), - findsOneWidget, - ); - expect(find.text('Find battery chemistry sources'), findsNothing); + expect(find.text('2 schedules'), findsOneWidget); + // The strip carries the count only; the helper line lives in the + // empty state. + expect(find.textContaining('not pipeline definitions'), findsNothing); + // Two lines per row: the name with its next run, then the timer + // and pinned pipeline version. The editor holds the rest. + expect(find.text('Research batteries'), findsOneWidget); + expect(find.text('22 Oct'), findsOneWidget); + expect( + find.text('Every 24h · mon, wed · Pipeline 4 · v2'), + findsOneWidget, + ); + expect(find.text('Find battery chemistry sources'), findsNothing); - await tester.scrollUntilVisible( - find.text('Nightly report'), - 300, - scrollable: find.descendant( - of: find.byKey(scheduleListKey), - matching: find.byType(Scrollable), - ), - ); - expect(find.text('Nightly report'), findsOneWidget); - expect(find.text('10:00, 18:30 · Pipeline 7 · v5'), findsOneWidget); - expect(find.text('Paused'), findsOneWidget); + await tester.scrollUntilVisible( + find.text('Nightly report'), + 300, + scrollable: find.descendant( + of: find.byKey(scheduleListKey), + matching: find.byType(Scrollable), + ), + ); + expect(find.text('Nightly report'), findsOneWidget); + expect(find.text('10:00, 18:30 · Pipeline 7 · v5'), findsOneWidget); + expect(find.text('Paused'), findsOneWidget); - if (cupertino) { - expect(find.byType(CupertinoSearchTextField), findsOneWidget); - expect( - find.byType(CupertinoSlidingSegmentedControl), - findsOneWidget, - ); - expect(find.byType(CupertinoButton), findsWidgets); - expect(find.byType(TextField), findsNothing); - } else { - expect(find.byKey(scheduleSearchFieldKey), findsOneWidget); - expect( - find.byType(SegmentedButton), - findsOneWidget, - ); - expect(find.byType(TextField), findsOneWidget); - } - expect(tester.takeException(), isNull); - }); - } + expect(find.byKey(scheduleSearchFieldKey), findsOneWidget); + expect( + find.byType(SegmentedButton), + findsOneWidget, + ); + expect(find.byType(TextField), findsOneWidget); + expect(tester.takeException(), isNull); + }); } } diff --git a/app/test/features/schedules/ui/list/schedules_screen_test.dart b/app/test/features/schedules/ui/list/schedules_screen_test.dart index da42963a..96333462 100644 --- a/app/test/features/schedules/ui/list/schedules_screen_test.dart +++ b/app/test/features/schedules/ui/list/schedules_screen_test.dart @@ -9,60 +9,52 @@ import 'schedule_list_test_support.dart'; import 'schedule_screen_harness.dart'; void main() { - testWidgets('search covers name, prompt and pipeline in both themes', ( - tester, - ) async { - for (final cupertino in [false, true]) { - final gateway = FakeSchedulesGateway( - (type, fields) async => - schedulesReply([scheduleRecord(), pausedRecord()]), - ); - await pumpSchedules(tester, cupertino: cupertino, gateway: gateway); + testWidgets('search covers name, prompt and pipeline', (tester) async { + final gateway = FakeSchedulesGateway( + (type, fields) async => + schedulesReply([scheduleRecord(), pausedRecord()]), + ); + await pumpSchedules(tester, cupertino: false, gateway: gateway); - await tester.enterText(find.byKey(scheduleSearchFieldKey), 'pipeline 7'); - await tester.pump(); - expect(find.text('Nightly report'), findsOneWidget); - expect(find.text('Research batteries'), findsNothing); - expect(find.text('1 of 2 schedules'), findsOneWidget); + await tester.enterText(find.byKey(scheduleSearchFieldKey), 'pipeline 7'); + await tester.pump(); + expect(find.text('Nightly report'), findsOneWidget); + expect(find.text('Research batteries'), findsNothing); + expect(find.text('1 of 2 schedules'), findsOneWidget); - await tester.enterText( - find.byKey(scheduleSearchFieldKey), - 'battery chemistry', - ); - await tester.pump(); - expect(find.text('Research batteries'), findsOneWidget); - expect(find.text('Nightly report'), findsNothing); + await tester.enterText( + find.byKey(scheduleSearchFieldKey), + 'battery chemistry', + ); + await tester.pump(); + expect(find.text('Research batteries'), findsOneWidget); + expect(find.text('Nightly report'), findsNothing); - await tester.enterText(find.byKey(scheduleSearchFieldKey), 'no match'); - await tester.pump(); - expect(find.text('No schedules match this search.'), findsOneWidget); - expect(tester.takeException(), isNull); - } + await tester.enterText(find.byKey(scheduleSearchFieldKey), 'no match'); + await tester.pump(); + expect(find.text('No schedules match this search.'), findsOneWidget); + expect(tester.takeException(), isNull); }); - testWidgets('enabled filter removes paused schedules in both themes', ( - tester, - ) async { - for (final cupertino in [false, true]) { - final gateway = FakeSchedulesGateway( - (type, fields) async => - schedulesReply([scheduleRecord(), pausedRecord()]), - ); - await pumpSchedules(tester, cupertino: cupertino, gateway: gateway); + testWidgets('enabled filter removes paused schedules', (tester) async { + final gateway = FakeSchedulesGateway( + (type, fields) async => + schedulesReply([scheduleRecord(), pausedRecord()]), + ); + await pumpSchedules(tester, cupertino: false, gateway: gateway); - await tester.tap( - find.descendant( - of: find.byKey(scheduleFilterKey), - matching: find.text('Enabled'), - ), - ); - await tester.pumpAndSettle(); + await tester.tap( + find.descendant( + of: find.byKey(scheduleFilterKey), + matching: find.text('Enabled'), + ), + ); + await tester.pumpAndSettle(); - expect(find.text('Research batteries'), findsOneWidget); - expect(find.text('Nightly report'), findsNothing); - expect(find.text('1 of 2 schedules'), findsOneWidget); - expect(tester.takeException(), isNull); - } + expect(find.text('Research batteries'), findsOneWidget); + expect(find.text('Nightly report'), findsNothing); + expect(find.text('1 of 2 schedules'), findsOneWidget); + expect(tester.takeException(), isNull); }); testWidgets('row selection opens the exact record and never mutates', ( diff --git a/app/test/features/schedules/ui/list/schedules_wide_test.dart b/app/test/features/schedules/ui/list/schedules_wide_test.dart index 9598ae37..b88b83cd 100644 --- a/app/test/features/schedules/ui/list/schedules_wide_test.dart +++ b/app/test/features/schedules/ui/list/schedules_wide_test.dart @@ -10,45 +10,41 @@ import 'schedule_screen_harness.dart'; /// On a wide window the rows share the toolbar strip's width, and the strip /// is one row: the field, the filter and the count as a muted label. void main() { - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; + testWidgets('Material 1200: rows end under the strip and the strip is one ' + 'row', (tester) async { + await pumpSchedules( + tester, + cupertino: false, + size: const Size(1200, 800), + gateway: FakeSchedulesGateway( + (type, fields) async => schedulesReply([ + scheduleRecord(nextDue: '2026-10-22T09:00:00'), + pausedRecord(), + ]), + ), + ); + final strip = tester.getRect(find.byKey(scheduleToolbarKey)); + final row = tester.getRect(find.byKey(appListRowSurfaceKey).first); + expect(row.left, 0); + expect(row.width, kScheduleListMaxWidth); + // The row's trailing time ends inside the strip's trailing edge. + // The trailing time is the row's rightmost text, whatever its wording. + final time = find + .descendant( + of: find.byKey(appListRowSurfaceKey).first, + matching: find.byType(Text), + ) + .evaluate() + .map((element) => tester.getRect(find.byWidget(element.widget))) + .reduce((a, b) => a.right >= b.right ? a : b); + expect(time.right, lessThanOrEqualTo(strip.right - 12 + 0.5)); - testWidgets('$host 1200: rows end under the strip and the strip is one ' - 'row', (tester) async { - await pumpSchedules( - tester, - cupertino: cupertino, - size: const Size(1200, 800), - gateway: FakeSchedulesGateway( - (type, fields) async => schedulesReply([ - scheduleRecord(nextDue: '2026-10-22T09:00:00'), - pausedRecord(), - ]), - ), - ); - final strip = tester.getRect(find.byKey(scheduleToolbarKey)); - final row = tester.getRect(find.byKey(appListRowSurfaceKey).first); - expect(row.left, 0); - expect(row.width, kScheduleListMaxWidth); - // The row's trailing time ends inside the strip's trailing edge. - // The trailing time is the row's rightmost text, whatever its wording. - final time = find - .descendant( - of: find.byKey(appListRowSurfaceKey).first, - matching: find.byType(Text), - ) - .evaluate() - .map((element) => tester.getRect(find.byWidget(element.widget))) - .reduce((a, b) => a.right >= b.right ? a : b); - expect(time.right, lessThanOrEqualTo(strip.right - 12 + 0.5)); - - // Field, filter and count on one line. - final field = tester.getRect(find.byKey(scheduleSearchFieldKey)); - final filter = tester.getRect(find.byKey(scheduleFilterKey)); - final count = tester.getRect(find.text('2 schedules')); - expect((field.center.dy - filter.center.dy).abs(), lessThan(4)); - expect((count.center.dy - filter.center.dy).abs(), lessThan(4)); - expect(find.textContaining('not pipeline definitions'), findsNothing); - }); - } + // Field, filter and count on one line. + final field = tester.getRect(find.byKey(scheduleSearchFieldKey)); + final filter = tester.getRect(find.byKey(scheduleFilterKey)); + final count = tester.getRect(find.text('2 schedules')); + expect((field.center.dy - filter.center.dy).abs(), lessThan(4)); + expect((count.center.dy - filter.center.dy).abs(), lessThan(4)); + expect(find.textContaining('not pipeline definitions'), findsNothing); + }); } diff --git a/app/test/features/search/search_bar_layout_test.dart b/app/test/features/search/search_bar_layout_test.dart index f102e556..aec06ef2 100644 --- a/app/test/features/search/search_bar_layout_test.dart +++ b/app/test/features/search/search_bar_layout_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/search/search_screen.dart'; @@ -25,177 +24,141 @@ Future _search(WidgetTester tester, String query) async { await tester.pumpAndSettle(); } -Widget _app(bool cupertino, Widget child) => - cupertino ? CupertinoApp(home: child) : MaterialApp(home: child); +Widget _app(Widget child) => MaterialApp(home: child); void main() { - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; + testWidgets('the field, Kind and help live in the bar pill', (tester) async { + _size(tester, 390); + final gateway = ImmediateGateway((_, _) => response([pipeline])); + await tester.pumpWidget( + _app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)), + ); - testWidgets('$host: the field, Kind and help live in the bar pill', ( - tester, - ) async { - _size(tester, 390); - final gateway = ImmediateGateway((_, _) => response([pipeline])); - await tester.pumpWidget( - _app( - cupertino, - SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: cupertino), - ), - ); - - for (final key in [searchFieldKey, searchKindKey, searchHelpKey]) { - expect( - find.descendant( - of: find.byType(SegmentedBar), - matching: find.byKey(key), - ), - findsOneWidget, - reason: '$key is in the bar', - ); - } - // One field per platform: no elevated SearchBar, no dropdown. - expect(find.byType(SearchBar), findsNothing); - expect(find.byType(DropdownButton), findsNothing); - expect( - find.byType(CupertinoSearchTextField), - cupertino ? findsOneWidget : findsNothing, - ); - // The syntax help is behind the info button, not on the page. - expect(find.text(searchTokenHint), findsNothing); - await tester.tap(find.byKey(searchHelpKey)); - await tester.pumpAndSettle(); - expect(find.text(searchTokenHint), findsOneWidget); - }); - - testWidgets('$host: stats appear only for a truncated answer', ( - tester, - ) async { - _size(tester, 390); - var truncated = false; - final gateway = ImmediateGateway((_, _) { - final reply = response([pipeline]); - (reply['search_results'] as Map)['truncated'] = truncated; - return reply; - }); - await tester.pumpWidget( - _app( - cupertino, - SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: cupertino), - ), - ); - - await _search(tester, 'release'); - expect(find.text('Release planner'), findsOneWidget); - expect(find.byKey(searchBoundsKey), findsNothing); - expect(find.textContaining('scanned'), findsNothing); - - truncated = true; - await _search(tester, 'releases'); - expect(find.byKey(searchBoundsKey), findsOneWidget); - expect(find.textContaining('Results truncated'), findsOneWidget); - }); - - testWidgets('$host: rows are the shared row: title, kind-led line', ( - tester, - ) async { - _size(tester, 390); - final gateway = ImmediateGateway((_, _) => response([field])); - await tester.pumpWidget( - _app( - cupertino, - SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: cupertino), - ), - ); - await _search(tester, 'release'); - - final row = find.byKey(const ValueKey('search.result.run:11:4:output')); - expect(row, findsOneWidget); - expect(tester.widget(row).cupertino, cupertino); - // The kind leads the one muted line, before the snippet. - expect( - find.descendant(of: row, matching: find.textContaining('Field · ')), - findsOneWidget, - ); + for (final key in [searchFieldKey, searchKindKey, searchHelpKey]) { expect( find.descendant( - of: row, - matching: find.textContaining('the release is ready'), + of: find.byType(SegmentedBar), + matching: find.byKey(key), ), findsOneWidget, + reason: '$key is in the bar', ); - }); + } + // One field: no elevated SearchBar, no dropdown and no native field. + expect(find.byType(SearchBar), findsNothing); + expect(find.byType(DropdownButton), findsNothing); + // The syntax help is behind the info button, not on the page. + expect(find.text(searchTokenHint), findsNothing); + await tester.tap(find.byKey(searchHelpKey)); + await tester.pumpAndSettle(); + expect(find.text(searchTokenHint), findsOneWidget); + }); - testWidgets('$host: results run behind the bar in a capped column', ( - tester, - ) async { - _size(tester, 1200); + testWidgets('stats appear only for a truncated answer', (tester) async { + _size(tester, 390); + var truncated = false; + final gateway = ImmediateGateway((_, _) { + final reply = response([pipeline]); + (reply['search_results'] as Map)['truncated'] = truncated; + return reply; + }); + await tester.pumpWidget( + _app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)), + ); + + await _search(tester, 'release'); + expect(find.text('Release planner'), findsOneWidget); + expect(find.byKey(searchBoundsKey), findsNothing); + expect(find.textContaining('scanned'), findsNothing); + + truncated = true; + await _search(tester, 'releases'); + expect(find.byKey(searchBoundsKey), findsOneWidget); + expect(find.textContaining('Results truncated'), findsOneWidget); + }); + + testWidgets('rows are the shared row: title, kind-led line', (tester) async { + _size(tester, 390); + final gateway = ImmediateGateway((_, _) => response([field])); + await tester.pumpWidget( + _app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)), + ); + await _search(tester, 'release'); + + final row = find.byKey(const ValueKey('search.result.run:11:4:output')); + expect(row, findsOneWidget); + expect(tester.widget(row).cupertino, isFalse); + // The kind leads the one muted line, before the snippet. + expect( + find.descendant(of: row, matching: find.textContaining('Field · ')), + findsOneWidget, + ); + expect( + find.descendant( + of: row, + matching: find.textContaining('the release is ready'), + ), + findsOneWidget, + ); + }); + + testWidgets('results run behind the bar in a capped column', (tester) async { + _size(tester, 1200); + final gateway = ImmediateGateway((_, _) => response([pipeline])); + await tester.pumpWidget( + _app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)), + ); + await _search(tester, 'release'); + + // The scroll view reaches the top edge; its first row starts below + // the floating bar. + final scroll = find.byType(CustomScrollView); + expect(tester.getTopLeft(scroll).dy, 0); + final barBottom = tester.getBottomLeft(find.byType(SegmentedBar)).dy; + final row = find.byKey(const ValueKey('search.result.pipeline:7')); + expect(tester.getTopLeft(row).dy, greaterThanOrEqualTo(barBottom - 8)); + // The row spans the whole window between the bar's insets: no + // reading-width cap on a wide window. + final rect = tester.getRect(row); + expect(rect.left, kSearchContentInset); + expect(rect.right, 1200 - kSearchContentInset); + }); + + for (final width in [390.0, 880.0, 1200.0, 1400.0]) { + testWidgets('at $width the field takes the title\'s place and ' + 'the results line up with it', (tester) async { + _size(tester, width); final gateway = ImmediateGateway((_, _) => response([pipeline])); await tester.pumpWidget( - _app( - cupertino, - SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: cupertino), - ), + _app(SearchScreen(gateway: gateway, onOpen: (_) {}, cupertino: false)), ); await _search(tester, 'release'); - // The scroll view reaches the top edge; its first row starts below - // the floating bar. - final scroll = find.byType(CustomScrollView); - expect(tester.getTopLeft(scroll).dy, 0); - final barBottom = tester.getBottomLeft(find.byType(SegmentedBar)).dy; - final row = find.byKey(const ValueKey('search.result.pipeline:7')); - expect(tester.getTopLeft(row).dy, greaterThanOrEqualTo(barBottom - 8)); - // The row spans the whole window between the bar's insets: no - // reading-width cap on a wide window. - final rect = tester.getRect(row); - expect(rect.left, kSearchContentInset); - expect(rect.right, 1200 - kSearchContentInset); + final bar = find.byType(SegmentedBar); + // No Search title pill: the field's pill is the bar's only piece. + expect( + find.descendant(of: bar, matching: find.text('Search')), + findsNothing, + ); + expect( + find.descendant(of: bar, matching: find.byType(GlassPill)), + findsOneWidget, + ); + final pill = tester.getRect( + find.descendant(of: bar, matching: find.byType(GlassPill)), + ); + expect(pill.left, kSearchContentInset); + // The pill grows with the bar: the whole width between its insets. + expect(pill.width, width - 2 * kSearchContentInset); + // The field fills the pill beside Kind and the help. + final field = tester.getRect(find.byKey(searchFieldKey)); + expect(field.width, greaterThan(pill.width * 0.6)); + // The result column shares the pill's edges, so it spans the pane. + final row = tester.getRect( + find.byKey(const ValueKey('search.result.pipeline:7')), + ); + expect(row.left, pill.left); + expect(row.right, pill.right); }); - - for (final width in [390.0, 880.0, 1200.0, 1400.0]) { - testWidgets('$host: at $width the field takes the title\'s place and ' - 'the results line up with it', (tester) async { - _size(tester, width); - final gateway = ImmediateGateway((_, _) => response([pipeline])); - await tester.pumpWidget( - _app( - cupertino, - SearchScreen( - gateway: gateway, - onOpen: (_) {}, - cupertino: cupertino, - ), - ), - ); - await _search(tester, 'release'); - - final bar = find.byType(SegmentedBar); - // No Search title pill: the field's pill is the bar's only piece. - expect( - find.descendant(of: bar, matching: find.text('Search')), - findsNothing, - ); - expect( - find.descendant(of: bar, matching: find.byType(GlassPill)), - findsOneWidget, - ); - final pill = tester.getRect( - find.descendant(of: bar, matching: find.byType(GlassPill)), - ); - expect(pill.left, kSearchContentInset); - // The pill grows with the bar: the whole width between its insets. - expect(pill.width, width - 2 * kSearchContentInset); - // The field fills the pill beside Kind and the help. - final field = tester.getRect(find.byKey(searchFieldKey)); - expect(field.width, greaterThan(pill.width * 0.6)); - // The result column shares the pill's edges, so it spans the pane. - final row = tester.getRect( - find.byKey(const ValueKey('search.result.pipeline:7')), - ); - expect(row.left, pill.left); - expect(row.right, pill.right); - }); - } } } diff --git a/app/test/features/search/search_chat_screen_test.dart b/app/test/features/search/search_chat_screen_test.dart index d20adb5e..154b6cc5 100644 --- a/app/test/features/search/search_chat_screen_test.dart +++ b/app/test/features/search/search_chat_screen_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -17,67 +16,59 @@ JsonMap replies(String query, String kind) => kind == 'chat' ]) : response([field]); -Widget host(Widget child, {required bool cupertino}) => - cupertino ? CupertinoApp(home: child) : MaterialApp(home: child); +Widget host(Widget child) => MaterialApp(home: child); void main() { - for (final cupertino in [false, true]) { - final platform = cupertino ? 'Cupertino' : 'Material'; - - testWidgets('$platform: chat hits lead as a Chats group with title, ' - 'harness, directory and snippet, and open their chat', (tester) async { - useNarrowSurface(tester); - final gateway = ImmediateGateway(replies); - JsonMap? opened; - await tester.pumpWidget( - host( - SearchScreen( - gateway: gateway, - onOpen: (value) => opened = value, - cupertino: cupertino, - ), - cupertino: cupertino, + testWidgets('chat hits lead as a Chats group with title, ' + 'harness, directory and snippet, and open their chat', (tester) async { + useNarrowSurface(tester); + final gateway = ImmediateGateway(replies); + JsonMap? opened; + await tester.pumpWidget( + host( + SearchScreen( + gateway: gateway, + onOpen: (value) => opened = value, + cupertino: false, ), - ); - await search(tester, 'release'); + ), + ); + await search(tester, 'release'); - expect(gateway.calls.single['search'], { - 'query': 'release', - 'kind': '', - 'limit': 0, - }); - expect(gateway.chatCalls.single['search'], { - 'query': 'release', - 'kind': 'chat', - 'limit': 0, - }); - expect(find.text('Chats (2)'), findsOneWidget); - expect(find.text('Pipelines and runs'), findsOneWidget); - final chats = tester.getTopLeft(find.byKey(searchChatsSectionKey)); - final others = tester.getTopLeft(find.byKey(searchOthersSectionKey)); - final chatRow = find.byKey(const ValueKey('search.result.chat:ses_a')); - final runRow = find.byKey( - const ValueKey('search.result.run:11:4:output'), - ); - expect(chats.dy, lessThan(tester.getTopLeft(chatRow).dy)); - expect(tester.getTopLeft(chatRow).dy, lessThan(others.dy)); - expect(others.dy, lessThan(tester.getTopLeft(runRow).dy)); - - expect(find.text('API refactor'), findsOneWidget); - expect(find.text('Release notes'), findsOneWidget); - expect( - find.textContaining('Chat · Claude Code · /work/api'), - findsNWidgets(2), - ); - expect(find.textContaining('the release retry'), findsOneWidget); - expect(tester.takeException(), isNull); - - await tester.tap(chatRow); - await tester.pump(); - expect(opened?['target'], 'chat:ses_a'); - expect((opened?['chat'] as Map)['session_id'], 'ses_a'); + expect(gateway.calls.single['search'], { + 'query': 'release', + 'kind': '', + 'limit': 0, }); - } + expect(gateway.chatCalls.single['search'], { + 'query': 'release', + 'kind': 'chat', + 'limit': 0, + }); + expect(find.text('Chats (2)'), findsOneWidget); + expect(find.text('Pipelines and runs'), findsOneWidget); + final chats = tester.getTopLeft(find.byKey(searchChatsSectionKey)); + final others = tester.getTopLeft(find.byKey(searchOthersSectionKey)); + final chatRow = find.byKey(const ValueKey('search.result.chat:ses_a')); + final runRow = find.byKey(const ValueKey('search.result.run:11:4:output')); + expect(chats.dy, lessThan(tester.getTopLeft(chatRow).dy)); + expect(tester.getTopLeft(chatRow).dy, lessThan(others.dy)); + expect(others.dy, lessThan(tester.getTopLeft(runRow).dy)); + + expect(find.text('API refactor'), findsOneWidget); + expect(find.text('Release notes'), findsOneWidget); + expect( + find.textContaining('Chat · Claude Code · /work/api'), + findsNWidgets(2), + ); + expect(find.textContaining('the release retry'), findsOneWidget); + expect(tester.takeException(), isNull); + + await tester.tap(chatRow); + await tester.pump(); + expect(opened?['target'], 'chat:ses_a'); + expect((opened?['chat'] as Map)['session_id'], 'ses_a'); + }); testWidgets('Chats selected alone lists chats without group headings', ( tester, diff --git a/app/test/features/search/search_screen_test.dart b/app/test/features/search/search_screen_test.dart index 1ec3ba60..aa6ab7f3 100644 --- a/app/test/features/search/search_screen_test.dart +++ b/app/test/features/search/search_screen_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -145,34 +144,6 @@ void main() { ); } - testWidgets( - 'Cupertino search uses native controls and opens the real target', - (tester) async { - useNarrowSurface(tester); - final gateway = ImmediateGateway((_, _) => response([pipeline])); - JsonMap? opened; - await tester.pumpWidget( - CupertinoApp( - home: largeText( - SearchScreen( - gateway: gateway, - onOpen: (value) => opened = value, - cupertino: true, - ), - ), - ), - ); - - expect(find.byType(CupertinoSearchTextField), findsOneWidget); - await search(tester, 'release'); - - expect(find.text('Release planner'), findsOneWidget); - expect(tester.takeException(), isNull); - await tester.tap(find.byKey(const ValueKey('search.result.pipeline:7'))); - expect(opened?['target'], 'pipeline:7'); - }, - ); - testWidgets('a read-only hit cannot be opened', (tester) async { useNarrowSurface(tester); final unknown = hit( diff --git a/app/test/shell/search_escape_test.dart b/app/test/shell/search_escape_test.dart index 5c728c3f..348d8594 100644 --- a/app/test/shell/search_escape_test.dart +++ b/app/test/shell/search_escape_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -35,16 +34,11 @@ Future _search(WidgetTester tester) async { await tester.pumpAndSettle(); } -Future _pump( - WidgetTester tester, - AppDestination from, { - bool cupertino = false, -}) async { +Future _pump(WidgetTester tester, AppDestination from) async { tester.view.physicalSize = const Size(1200, 900); tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); final shell = AdaptiveShell( - cupertino: cupertino, destination: from, destinationBodies: { for (final destination in AppDestination.values) @@ -53,9 +47,7 @@ Future _pump( SearchScreen(gateway: _Gateway(), onOpen: (_) {}, embedded: true), }, ); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell), - ); + await tester.pumpWidget(MaterialApp(home: shell)); await tester.pumpAndSettle(); } @@ -87,24 +79,6 @@ void main() { ); } - testWidgets( - 'Cupertino Escape preserves native Search focus handoff and previous tab', - (tester) async { - await _pump(tester, AppDestination.runs, cupertino: true); - await _search(tester); - await tester.enterText(find.byKey(searchFieldKey), 'query'); - await tester.pumpAndSettle(); - _field(tester).focusNode.unfocus(); - await tester.pumpAndSettle(); - await _press(tester, LogicalKeyboardKey.escape); - expect(_field(tester).focusNode.hasPrimaryFocus, isTrue); - expect(_field(tester).controller.text, 'query'); - await _press(tester, LogicalKeyboardKey.escape); - expect(find.text('Body runs'), findsOneWidget); - await tester.pumpWidget(const SizedBox.shrink()); - }, - ); - testWidgets('Escape dismisses a Search dialog before changing tabs', ( tester, ) async { diff --git a/app/test/shell/search_shortcuts_test.dart b/app/test/shell/search_shortcuts_test.dart index 69d3e381..e788a6fa 100644 --- a/app/test/shell/search_shortcuts_test.dart +++ b/app/test/shell/search_shortcuts_test.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -130,58 +129,4 @@ void main() { variant: TargetPlatformVariant.only(platform), ); } - testWidgets( - 'Cupertino Command slash retains primary focus after query updates', - (tester) async { - final composer = TextEditingController(text: 'draft'); - final focus = FocusNode(); - addTearDown(composer.dispose); - addTearDown(focus.dispose); - await tester.pumpWidget( - CupertinoApp( - home: AdaptiveShell( - cupertino: true, - destination: AppDestination.chat, - destinationBodies: { - AppDestination.chat: (_) => - CupertinoTextField(controller: composer, focusNode: focus), - AppDestination.search: (_) => SearchScreen( - gateway: _Gateway(), - onOpen: (_) {}, - embedded: true, - ), - }, - ), - ), - ); - await tester.pumpAndSettle(); - focus.requestFocus(); - await tester.pump(); - await _chord(tester, [ - LogicalKeyboardKey.metaLeft, - ], LogicalKeyboardKey.slash); - EditableText field() => tester.widget( - find.descendant( - of: find.byKey(searchFieldKey), - matching: find.byType(EditableText), - ), - ); - expect(field().focusNode.hasPrimaryFocus, isTrue); - await tester.enterText(find.byKey(searchFieldKey), 'release'); - await tester.pumpAndSettle(const Duration(milliseconds: 300)); - await tester.pump(const Duration(seconds: 1)); - expect(field().controller.text, 'release'); - expect(field().focusNode.hasPrimaryFocus, isTrue); - await tester.tap(find.byKey(const ValueKey('shell.destination.chat'))); - await tester.pumpAndSettle(); - focus.requestFocus(); - await tester.pump(); - await _chord(tester, [ - LogicalKeyboardKey.metaLeft, - ], LogicalKeyboardKey.slash); - expect(field().controller.text, 'release'); - expect(field().focusNode.hasPrimaryFocus, isTrue); - }, - variant: TargetPlatformVariant.only(TargetPlatform.macOS), - ); } diff --git a/app/test/ui/adaptive/glass_bar_test.dart b/app/test/ui/adaptive/glass_bar_test.dart index 9c758696..a29af14a 100644 --- a/app/test/ui/adaptive/glass_bar_test.dart +++ b/app/test/ui/adaptive/glass_bar_test.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart'; @@ -23,21 +22,18 @@ import '../../features/artifacts/ui/artifact_visit_list_fixture.dart'; import '../../features/chat/conversation/chat_composer_bar_fixtures.dart'; /// Every glass control bar keeps its first and last controls as far from the -/// pill's sides as from its top and bottom, and spaces neighbours evenly, on -/// both hosts, at phone width and at a larger text size. +/// pill's sides as from its top and bottom, and spaces neighbours evenly, at +/// phone width and at a larger text size. const _phone = Size(390, 844); const _scales = [1.0, 1.3]; -const _hosts = [false, true]; final Uint8List _png = base64Decode( 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAE' 'hQGAhKmMIQAAAABJRU5ErkJggg==', ); -Widget _host(bool cupertino, Widget child) => cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: child)) - : MaterialApp(home: Scaffold(body: child)); +Widget _host(Widget child) => MaterialApp(home: Scaffold(body: child)); Future _setUp(WidgetTester tester, double scale) async { tester.view.physicalSize = _phone * tester.view.devicePixelRatio; @@ -50,9 +46,7 @@ Future _setUp(WidgetTester tester, double scale) async { List _controls(WidgetTester tester, Finder pill) { final found = find.descendant( of: pill, - matching: find.byWidgetPredicate( - (widget) => widget is IconButton || widget is CupertinoButton, - ), + matching: find.byWidgetPredicate((widget) => widget is IconButton), ); final rects = [ for (var i = 0; i < found.evaluate().length; i++) @@ -101,248 +95,210 @@ Rect _pillOf(WidgetTester tester, Finder inside) => tester.getRect( ); void main() { - for (final cupertino in _hosts) { - final host = cupertino ? 'Cupertino' : 'Material'; - for (final scale in _scales) { - final when = '$host, text x$scale'; + for (final scale in _scales) { + final when = 'text x$scale'; - testWidgets('artifact viewer bar: equal end gaps ($when)', ( - tester, - ) async { - await _setUp(tester, scale); - for (final count in [1, 3]) { - final artifacts = [ - for (var i = 0; i < count; i++) - recordedArtifact( - 'shot-$i.png', - url: '/artifacts/1/1/shot-$i.png', - contentType: 'image/png', - ), - ]; - final group = ArtifactGroup( - stageKey: 'review', - visit: 1, - artifacts: artifacts, - ); - await tester.pumpWidget( - _host( - cupertino, - ArtifactViewerPage( - key: ValueKey(count), - groups: [group], - selectedIdentity: artifactVisitIdentity(group, artifacts.first), - configuredEndpoint: 'ws://127.0.0.1:8081/connect', - fetch: (_) async => - ArtifactFetchResult(status: 200, bytes: _png), - markdownBuilder: (context, value) => Text(value), - openExternal: (_) async => true, - ), + testWidgets('artifact viewer bar: equal end gaps ($when)', (tester) async { + await _setUp(tester, scale); + for (final count in [1, 3]) { + final artifacts = [ + for (var i = 0; i < count; i++) + recordedArtifact( + 'shot-$i.png', + url: '/artifacts/1/1/shot-$i.png', + contentType: 'image/png', ), - ); - await tester.pumpAndSettle(); - final row = find.byKey(const Key('artifact-viewer-actions')); - final pill = _pillOf(tester, row); - final controls = _controls(tester, row); - expect(controls.length, greaterThanOrEqualTo(2)); - _expectEqualEnds(pill, controls.first, controls.last); - _expectEvenNeighbours( - count > 1 ? controls.sublist(0, controls.length - 2) : controls, - ); - if (count > 1) { - _expectEvenNeighbours(controls.sublist(controls.length - 2)); - } - expect(pill.height, closeTo(GlassBarMetrics.height(cupertino), 1)); - expect(tester.takeException(), isNull); - } - }); - - testWidgets('diff page pager: position and chevrons inset ($when)', ( - tester, - ) async { - await _setUp(tester, scale); - await tester.pumpWidget( - _host( - cupertino, - FileDiffPage( - files: [ - for (final name in ['a', 'b', 'c']) - FileChange( - path: 'lib/$name.dart', - kind: ChangeKind.modified, - patch: - '--- a/lib/$name.dart\n+++ b/lib/$name.dart\n' - '@@ -1 +1 @@\n-x\n+y\n', - ), - ], - ), - ), - ); - await tester.pumpAndSettle(); - final pager = find.byKey(const ValueKey('file-diff-pager')); - _expectPager(tester, pager, cupertino, find.text('1 of 3')); - }); - - testWidgets('changes visit pager: equal end gaps ($when)', ( - tester, - ) async { - await _setUp(tester, scale); - Map visit(String stage, int sequence) => { - 'stage': stage, - 'sequence': sequence, - 'status': 'completed', - 'file_changes': { - 'status': 'complete', - 'scope': 'Git tracked files', - 'skipped': 0, - 'omitted': 0, - 'diagnostic': '', - 'files': [ - {'path': 'lib/$stage.dart', 'kind': 'added'}, - ], - }, - }; - await tester.pumpWidget( - _host( - cupertino, - ChangesViewer( - steps: [visit('build', 1), visit('review', 2)], - showSummary: false, - ), - ), - ); - await tester.pumpAndSettle(); - final position = find.byKey( - const ValueKey('changes-visit-position'), - ); - _expectPager( - tester, - find.ancestor(of: position, matching: find.byType(Row)).first, - cupertino, - position, - ); - }); - - testWidgets('chat composer: + and Send keep the pill gap ($when)', ( - tester, - ) async { - await _setUp(tester, scale); - final gateway = ComposerBarGateway(); - addTearDown(gateway.close); - final composer = ChatComposerController( - gateway, - 's', - drafts: MemoryChatDraftStore(), - ); - addTearDown(composer.dispose); - await tester.pumpWidget( - _host( - cupertino, - Align( - alignment: Alignment.bottomCenter, - child: ChatComposerBar( - composer: composer, - running: false, - placeholder: 'Message', - ), - ), - ), - ); - await tester.pumpAndSettle(); - final pill = tester.getRect( - find.byKey(const Key('chat-composer-pill')), - ); - final attach = tester.getRect( - find.byKey(const Key('chat-composer-attach')), - ); - final send = tester.getRect( - find.byKey(const Key('chat-composer-primary')), - ); - // The controls keep to the field's last line: each end control is as - // far from the pill's side as from its bottom, and while the field is - // one line (no taller than a control) as far from its top. - final row = GlassBarMetrics.controlExtent(cupertino); - final oneLine = - pill.height <= row + 2 * GlassBarMetrics.fieldEdgeGap + 0.5; - for (final (control, start) in [(attach, true), (send, false)]) { - final bottom = pill.bottom - control.bottom; - final side = start - ? control.left - pill.left - : pill.right - control.right; - expect(side, closeTo(bottom, 1), reason: 'side vs bottom'); - if (oneLine) { - expect(control.top - pill.top, closeTo(bottom, 1), reason: 'top'); - expect(bottom, closeTo((pill.height - control.height) / 2, 1)); - } - } - if (scale == 1.0) expect(oneLine, isTrue, reason: 'pill $pill'); - expect(tester.takeException(), isNull); - }); - - testWidgets('top bar actions pill: controls fill it evenly ($when)', ( - tester, - ) async { - await _setUp(tester, scale); - final actions = [ - for (final name in ['a', 'b', 'c']) - cupertino - ? CupertinoButton( - key: Key('action-$name'), - padding: EdgeInsets.zero, - onPressed: () {}, - child: const Icon(CupertinoIcons.info), - ) - : IconButton( - key: Key('action-$name'), - onPressed: () {}, - icon: const Icon(Icons.info_outline), - ), ]; + final group = ArtifactGroup( + stageKey: 'review', + visit: 1, + artifacts: artifacts, + ); await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - navigationBar: SegmentedBar( - cupertino: true, - title: 'Title', - actions: actions, - ), - child: const SizedBox.expand(), - ), - ) - : MaterialApp( - home: Scaffold( - appBar: SegmentedBar( - cupertino: false, - title: 'Title', - actions: actions, - ), - ), - ), + _host( + ArtifactViewerPage( + key: ValueKey(count), + groups: [group], + selectedIdentity: artifactVisitIdentity(group, artifacts.first), + configuredEndpoint: 'ws://127.0.0.1:8081/connect', + fetch: (_) async => ArtifactFetchResult(status: 200, bytes: _png), + markdownBuilder: (context, value) => Text(value), + openExternal: (_) async => true, + ), + ), ); await tester.pumpAndSettle(); - final first = find.byKey(const Key('action-a')); - final pill = _pillOf(tester, first); - final controls = [ - for (final name in ['a', 'b', 'c']) - tester.getRect(find.byKey(Key('action-$name'))), - ]; + final row = find.byKey(const Key('artifact-viewer-actions')); + final pill = _pillOf(tester, row); + final controls = _controls(tester, row); + expect(controls.length, greaterThanOrEqualTo(2)); _expectEqualEnds(pill, controls.first, controls.last); - _expectEvenNeighbours(controls); + _expectEvenNeighbours( + count > 1 ? controls.sublist(0, controls.length - 2) : controls, + ); + if (count > 1) { + _expectEvenNeighbours(controls.sublist(controls.length - 2)); + } + expect(pill.height, closeTo(GlassBarMetrics.height(false), 1)); expect(tester.takeException(), isNull); - }); - } + } + }); + + testWidgets('diff page pager: position and chevrons inset ($when)', ( + tester, + ) async { + await _setUp(tester, scale); + await tester.pumpWidget( + _host( + FileDiffPage( + files: [ + for (final name in ['a', 'b', 'c']) + FileChange( + path: 'lib/$name.dart', + kind: ChangeKind.modified, + patch: + '--- a/lib/$name.dart\n+++ b/lib/$name.dart\n' + '@@ -1 +1 @@\n-x\n+y\n', + ), + ], + ), + ), + ); + await tester.pumpAndSettle(); + final pager = find.byKey(const ValueKey('file-diff-pager')); + _expectPager(tester, pager, find.text('1 of 3')); + }); + + testWidgets('changes visit pager: equal end gaps ($when)', (tester) async { + await _setUp(tester, scale); + Map visit(String stage, int sequence) => { + 'stage': stage, + 'sequence': sequence, + 'status': 'completed', + 'file_changes': { + 'status': 'complete', + 'scope': 'Git tracked files', + 'skipped': 0, + 'omitted': 0, + 'diagnostic': '', + 'files': [ + {'path': 'lib/$stage.dart', 'kind': 'added'}, + ], + }, + }; + await tester.pumpWidget( + _host( + ChangesViewer( + steps: [visit('build', 1), visit('review', 2)], + showSummary: false, + ), + ), + ); + await tester.pumpAndSettle(); + final position = find.byKey( + const ValueKey('changes-visit-position'), + ); + _expectPager( + tester, + find.ancestor(of: position, matching: find.byType(Row)).first, + position, + ); + }); + + testWidgets('chat composer: + and Send keep the pill gap ($when)', ( + tester, + ) async { + await _setUp(tester, scale); + final gateway = ComposerBarGateway(); + addTearDown(gateway.close); + final composer = ChatComposerController( + gateway, + 's', + drafts: MemoryChatDraftStore(), + ); + addTearDown(composer.dispose); + await tester.pumpWidget( + _host( + Align( + alignment: Alignment.bottomCenter, + child: ChatComposerBar( + composer: composer, + running: false, + placeholder: 'Message', + ), + ), + ), + ); + await tester.pumpAndSettle(); + final pill = tester.getRect(find.byKey(const Key('chat-composer-pill'))); + final attach = tester.getRect( + find.byKey(const Key('chat-composer-attach')), + ); + final send = tester.getRect( + find.byKey(const Key('chat-composer-primary')), + ); + // The controls keep to the field's last line: each end control is as + // far from the pill's side as from its bottom, and while the field is + // one line (no taller than a control) as far from its top. + final row = GlassBarMetrics.controlExtent(false); + final oneLine = + pill.height <= row + 2 * GlassBarMetrics.fieldEdgeGap + 0.5; + for (final (control, start) in [(attach, true), (send, false)]) { + final bottom = pill.bottom - control.bottom; + final side = start + ? control.left - pill.left + : pill.right - control.right; + expect(side, closeTo(bottom, 1), reason: 'side vs bottom'); + if (oneLine) { + expect(control.top - pill.top, closeTo(bottom, 1), reason: 'top'); + expect(bottom, closeTo((pill.height - control.height) / 2, 1)); + } + } + if (scale == 1.0) expect(oneLine, isTrue, reason: 'pill $pill'); + expect(tester.takeException(), isNull); + }); + + testWidgets('top bar actions pill: controls fill it evenly ($when)', ( + tester, + ) async { + await _setUp(tester, scale); + final actions = [ + for (final name in ['a', 'b', 'c']) + IconButton( + key: Key('action-$name'), + onPressed: () {}, + icon: const Icon(Icons.info_outline), + ), + ]; + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + appBar: SegmentedBar( + cupertino: false, + title: 'Title', + actions: actions, + ), + ), + ), + ); + await tester.pumpAndSettle(); + final first = find.byKey(const Key('action-a')); + final pill = _pillOf(tester, first); + final controls = [ + for (final name in ['a', 'b', 'c']) + tester.getRect(find.byKey(Key('action-$name'))), + ]; + _expectEqualEnds(pill, controls.first, controls.last); + _expectEvenNeighbours(controls); + expect(tester.takeException(), isNull); + }); } } /// A pager row: its position text starts an icon's inset in from the pill's /// edge (where an icon at that end would be drawn), and its chevrons keep the /// rule's equal gaps at the other end. -void _expectPager( - WidgetTester tester, - Finder inside, - bool cupertino, - Finder position, -) { +void _expectPager(WidgetTester tester, Finder inside, Finder position) { final pill = _pillOf(tester, inside); final controls = _controls(tester, inside); expect(controls, hasLength(2)); @@ -353,14 +309,14 @@ void _expectPager( final gap = (pill.height - last.height) / 2; expect( text.left - pill.left, - closeTo(gap + GlassBarMetrics.iconInset(cupertino), 1), + closeTo(gap + GlassBarMetrics.iconInset(false), 1), ); // The chevrons keep the same gap from the position as from each other's // icons: one icon inset on each side. expect( controls.first.left - text.right, - greaterThanOrEqualTo(GlassBarMetrics.iconInset(cupertino) - 1), + greaterThanOrEqualTo(GlassBarMetrics.iconInset(false) - 1), ); - expect(pill.height, closeTo(GlassBarMetrics.height(cupertino), 1)); + expect(pill.height, closeTo(GlassBarMetrics.height(false), 1)); expect(tester.takeException(), isNull); } diff --git a/app/test/ui/input/cupertino_web_search_field_test.dart b/app/test/ui/input/cupertino_web_search_field_test.dart deleted file mode 100644 index e669297a..00000000 --- a/app/test/ui/input/cupertino_web_search_field_test.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'dart:ui' show Tristate; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:pipelines_app/ui/input/cupertino_web_search_field.dart'; - -void main() { - for (final provided in [false, true]) { - testWidgets( - 'native clear preserves semantics and focus (provided node: $provided)', - (tester) async { - final semantics = tester.ensureSemantics(); - - try { - final text = TextEditingController(); - final focus = FocusNode(); - addTearDown(text.dispose); - addTearDown(focus.dispose); - var clears = 0; - await tester.pumpWidget( - CupertinoApp( - home: CupertinoPageScaffold( - child: Center( - child: CupertinoWebSearchField( - controller: text, - placeholder: 'Search', - focusNode: provided ? focus : null, - onCleared: () { - clears++; - text.clear(); - }, - ), - ), - ), - ), - ); - final field = find.byType(EditableText); - final effective = tester.widget(field).focusNode; - effective.requestFocus(); - await tester.pumpAndSettle(); - final height = tester - .getSize(find.byType(CupertinoWebSearchField)) - .height; - final before = tester.getSemantics(field); - final identity = before.id; - expect( - before.getSemanticsData().flagsCollection.isEnabled, - Tristate.isTrue, - ); - await tester.enterText( - find.byType(CupertinoSearchTextField), - 'release', - ); - await tester.pumpAndSettle(); - final after = tester.getSemantics(field); - expect(after.id, identity); - expect( - tester.getSize(find.byType(CupertinoWebSearchField)).height, - height, - ); - expect( - after.getSemanticsData().flagsCollection.isEnabled, - Tristate.isTrue, - ); - expect(effective.hasPrimaryFocus, isTrue); - await tester.tap(find.byType(CupertinoButton)); - await tester.pumpAndSettle(); - expect(text.text, isEmpty); - expect(clears, 1); - expect( - tester.getSize(find.byType(CupertinoWebSearchField)).height, - height, - ); - expect(effective.hasPrimaryFocus, isTrue); - expect(tester.getSemantics(field).id, identity); - await tester.enterText( - find.byType(CupertinoSearchTextField), - 'again', - ); - await tester.pumpAndSettle(); - expect(text.text, 'again'); - expect(effective.hasPrimaryFocus, isTrue); - } finally { - semantics.dispose(); - } - }, - ); - } -} diff --git a/app/test/ui/motion/container_transform_route_test.dart b/app/test/ui/motion/container_transform_route_test.dart index fd733023..f984fc8a 100644 --- a/app/test/ui/motion/container_transform_route_test.dart +++ b/app/test/ui/motion/container_transform_route_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -11,10 +10,9 @@ const _rowColor = Color(0xFFE3F2FD); /// A list of three rows; tapping one pushes its page, grown from that row. class _List extends StatelessWidget { - const _List({required this.sources, required this.cupertino}); + const _List({required this.sources}); final ContainerTransformSources sources; - final bool cupertino; @override Widget build(BuildContext context) => ContainerTransformScope( @@ -33,8 +31,8 @@ class _List extends StatelessWidget { onTap: () => Navigator.of(context).push( ContainerTransformPageRoute( link: sources.link(() => id), - cupertino: cupertino, - builder: (_) => _Page(id: id, cupertino: cupertino), + cupertino: false, + builder: (_) => _Page(id: id), ), ), child: SizedBox(height: 72, child: Text('row $id')), @@ -46,42 +44,31 @@ class _List extends StatelessWidget { } class _Page extends StatelessWidget { - const _Page({required this.id, required this.cupertino}); + const _Page({required this.id}); final String id; - final bool cupertino; @override - Widget build(BuildContext context) => cupertino - ? CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(), - child: Center(child: Text('page $id')), - ) - : Scaffold( - appBar: AppBar(), - body: Center(child: Text('page $id')), - ); + Widget build(BuildContext context) => Scaffold( + appBar: AppBar(), + body: Center(child: Text('page $id')), + ); } Future _pump( WidgetTester tester, { - bool cupertino = false, bool reduced = false, }) async { tester.view.physicalSize = _screen; tester.view.devicePixelRatio = 1; addTearDown(tester.view.reset); final sources = ContainerTransformSources(); - final home = _List(sources: sources, cupertino: cupertino); + final home = _List(sources: sources); Widget media(BuildContext context, Widget? child) => MediaQuery( data: MediaQuery.of(context).copyWith(disableAnimations: reduced), child: child!, ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(builder: media, home: home) - : MaterialApp(builder: media, home: home), - ); + await tester.pumpWidget(MaterialApp(builder: media, home: home)); return sources; } @@ -186,7 +173,7 @@ void main() { ContainerTransformPageRoute( link: sources.link(() => 'missing'), cupertino: false, - builder: (_) => const _Page(id: 'x', cupertino: false), + builder: (_) => const _Page(id: 'x'), ), ); await tester.pump(); @@ -196,54 +183,6 @@ void main() { expect(find.text('page x'), findsOneWidget); }); - testWidgets('a Cupertino swipe back shrinks the page with the finger', ( - tester, - ) async { - await _pump(tester, cupertino: true); - final row = tester.getRect(find.byKey(const Key('row-b'))); - await tester.tap(find.byKey(const Key('row-b'))); - await tester.pumpAndSettle(); - expect(_surface(tester), Offset.zero & _screen); - - final gesture = await tester.startGesture(const Offset(5, 400)); - await gesture.moveBy(const Offset(20, 0)); - await gesture.moveBy(const Offset(100, 0)); - await tester.pump(); - final early = _surface(tester); - _expectBetween(early, row); - await gesture.moveBy(const Offset(100, 0)); - await tester.pump(); - final later = _surface(tester); - expect(later.height, lessThan(early.height), reason: 'follows the finger'); - - // Back toward the start edge, the page grows again. - await gesture.moveBy(const Offset(-150, 0)); - await tester.pump(); - expect(_surface(tester).height, greaterThan(later.height)); - - await gesture.moveBy(const Offset(200, 0)); - await gesture.up(); - await tester.pumpAndSettle(); - expect(find.text('page b'), findsNothing); - expect(find.byKey(const Key('row-b')), findsOneWidget); - }); - - testWidgets('a short Cupertino swipe released early stays on the page', ( - tester, - ) async { - await _pump(tester, cupertino: true); - await tester.tap(find.byKey(const Key('row-b'))); - await tester.pumpAndSettle(); - final gesture = await tester.startGesture(const Offset(5, 400)); - await gesture.moveBy(const Offset(20, 0)); - await gesture.moveBy(const Offset(40, 0)); - await tester.pump(); - await gesture.up(); - await tester.pumpAndSettle(); - expect(find.text('page b'), findsOneWidget); - expect(_surface(tester), Offset.zero & _screen); - }); - testWidgets('Android predictive back drives the shrink, then commits', ( tester, ) async { diff --git a/app/test/ui/navigation/bar_icon_button_test.dart b/app/test/ui/navigation/bar_icon_button_test.dart index 8f9a110b..455371eb 100644 --- a/app/test/ui/navigation/bar_icon_button_test.dart +++ b/app/test/ui/navigation/bar_icon_button_test.dart @@ -4,13 +4,11 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/input/app_search_field.dart'; import 'package:pipelines_app/ui/navigation/bar_icon_button.dart'; -Widget _row(bool cupertino, List children) { +Widget _row(List children) { final row = Center( child: Row(mainAxisSize: MainAxisSize.min, children: children), ); - return cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: row)) - : MaterialApp(home: Scaffold(body: row)); + return MaterialApp(home: Scaffold(body: row)); } BarIconButton _action(Key key, {bool busy = false}) => BarIconButton( @@ -23,73 +21,58 @@ BarIconButton _action(Key key, {bool busy = false}) => BarIconButton( ); void main() { - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; - final side = cupertino - ? kMinInteractiveDimensionCupertino - : kMinInteractiveDimension; + const side = kMinInteractiveDimension; - testWidgets('$host bar actions are whole, evenly sized touch targets', ( - tester, - ) async { - await tester.pumpWidget( - _row(cupertino, [ - _action(const ValueKey('a')), - _action(const ValueKey('b')), - _action(const ValueKey('c'), busy: true), - ]), - ); - for (final key in const ['a', 'b', 'c']) { - expect(tester.getSize(find.byKey(ValueKey(key))), Size(side, side)); - } - // Adjacent actions abut: the spacing is the targets', not padding. - expect( - tester.getTopLeft(find.byKey(const ValueKey('b'))).dx - - tester.getTopLeft(find.byKey(const ValueKey('a'))).dx, - side, - ); - if (cupertino) expect(find.byType(Material), findsNothing); - expect(find.bySemanticsLabel('Refresh'), findsWidgets); - }); + testWidgets('bar actions are whole, evenly sized touch targets', ( + tester, + ) async { + await tester.pumpWidget( + _row([ + _action(const ValueKey('a')), + _action(const ValueKey('b')), + _action(const ValueKey('c'), busy: true), + ]), + ); + for (final key in const ['a', 'b', 'c']) { + expect(tester.getSize(find.byKey(ValueKey(key))), Size(side, side)); + } + // Adjacent actions abut: the spacing is the targets', not padding. + expect( + tester.getTopLeft(find.byKey(const ValueKey('b'))).dx - + tester.getTopLeft(find.byKey(const ValueKey('a'))).dx, + side, + ); + expect(find.bySemanticsLabel('Refresh'), findsWidgets); + }); - testWidgets('$host search field is one stadium field with a clear', ( - tester, - ) async { - final text = TextEditingController(); - addTearDown(text.dispose); - var cleared = false; - await tester.pumpWidget( - _row(cupertino, [ - SizedBox( - width: 300, - child: AppSearchField( - fieldKey: const ValueKey('field'), - controller: text, - placeholder: 'Search', - onCleared: () => cleared = true, - ), + testWidgets('search field is one stadium field with a clear', (tester) async { + final text = TextEditingController(); + addTearDown(text.dispose); + var cleared = false; + await tester.pumpWidget( + _row([ + SizedBox( + width: 300, + child: AppSearchField( + fieldKey: const ValueKey('field'), + controller: text, + placeholder: 'Search', + onCleared: () => cleared = true, ), - ]), - ); - if (cupertino) { - expect(find.byType(CupertinoSearchTextField), findsOneWidget); - expect(find.byType(Material), findsNothing); - return; - } - final field = tester.widget( - find.byKey(const ValueKey('field')), - ); - final border = field.decoration!.enabledBorder! as OutlineInputBorder; - expect(border.borderSide, BorderSide.none); - expect(field.decoration!.filled, isTrue); - expect(find.byTooltip('Clear search'), findsNothing); + ), + ]), + ); + final field = tester.widget(find.byKey(const ValueKey('field'))); + final border = field.decoration!.enabledBorder! as OutlineInputBorder; + expect(border.borderSide, BorderSide.none); + expect(field.decoration!.filled, isTrue); + expect(find.byTooltip('Clear search'), findsNothing); - await tester.enterText(find.byKey(const ValueKey('field')), 'abc'); - await tester.pump(); - await tester.tap(find.byTooltip('Clear search')); - await tester.pump(); - expect(text.text, isEmpty); - expect(cleared, isTrue); - }); - } + await tester.enterText(find.byKey(const ValueKey('field')), 'abc'); + await tester.pump(); + await tester.tap(find.byTooltip('Clear search')); + await tester.pump(); + expect(text.text, isEmpty); + expect(cleared, isTrue); + }); } diff --git a/app/test/ui/theme/app_font_theme_test.dart b/app/test/ui/theme/app_font_theme_test.dart index 4f9e3ea5..bacaed08 100644 --- a/app/test/ui/theme/app_font_theme_test.dart +++ b/app/test/ui/theme/app_font_theme_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/application/app.dart'; @@ -27,69 +26,38 @@ void main() { expect(b?.fontSize, a?.fontSize); expect(b?.fontWeight, a?.fontWeight); } - expect( - build( - fontFamily: 'Inter', - ).cupertinoOverrideTheme?.textTheme?.textStyle.fontFamily, - 'Inter', - ); - expect(build().cupertinoOverrideTheme, isNull); } }); - test('the Cupertino theme takes the family in every text role', () { - expect(appCupertinoThemeWith(), same(appCupertinoTheme)); - final text = appCupertinoThemeWith(fontFamily: 'Inter').textTheme; - const stock = CupertinoTextThemeData(); - for (final (a, b) in <(TextStyle, TextStyle)>[ - (stock.textStyle, text.textStyle), - (stock.navTitleTextStyle, text.navTitleTextStyle), - (stock.navLargeTitleTextStyle, text.navLargeTitleTextStyle), - (stock.tabLabelTextStyle, text.tabLabelTextStyle), - (stock.actionTextStyle, text.actionTextStyle), - (stock.pickerTextStyle, text.pickerTextStyle), - ]) { - expect(b.fontFamily, 'Inter'); - expect(b.fontSize, a.fontSize); - expect(b.fontWeight, a.fontWeight); - } - expect( - appCupertinoThemeWith(fontFamily: 'Inter').scaffoldBackgroundColor, - AppColors.background, + testWidgets('the Material host switches font live, without a restart', ( + tester, + ) async { + final fonts = AppFontController( + store: MemoryAppFontStore(), + loader: (family, assets) async {}, ); + String? family; + await tester.pumpWidget( + MyApp( + fonts: fonts, + destination: AppDestination.settings, + destinationBodies: { + AppDestination.settings: (context) => Builder( + builder: (context) { + family = DefaultTextStyle.of(context).style.fontFamily; + return const Text('body'); + }, + ), + }, + ), + ); + final before = family; + expect(before, isNot('IBM Plex Sans')); + await fonts.select(AppFont.ibmPlexSans); + await tester.pumpAndSettle(); + expect(family, 'IBM Plex Sans'); + await fonts.select(AppFont.system); + await tester.pumpAndSettle(); + expect(family, before); }); - - for (final cupertino in [false, true]) { - testWidgets('the ${cupertino ? 'Cupertino' : 'Material'} host switches ' - 'font live, without a restart', (tester) async { - final fonts = AppFontController( - store: MemoryAppFontStore(), - loader: (family, assets) async {}, - ); - String? family; - await tester.pumpWidget( - MyApp( - cupertino: cupertino, - fonts: fonts, - destination: AppDestination.settings, - destinationBodies: { - AppDestination.settings: (context) => Builder( - builder: (context) { - family = DefaultTextStyle.of(context).style.fontFamily; - return const Text('body'); - }, - ), - }, - ), - ); - final before = family; - expect(before, isNot('IBM Plex Sans')); - await fonts.select(AppFont.ibmPlexSans); - await tester.pumpAndSettle(); - expect(family, 'IBM Plex Sans'); - await fonts.select(AppFont.system); - await tester.pumpAndSettle(); - expect(family, before); - }); - } } diff --git a/app/test/ui/theme/app_theme_test.dart b/app/test/ui/theme/app_theme_test.dart index 6a7337c4..ca7ce743 100644 --- a/app/test/ui/theme/app_theme_test.dart +++ b/app/test/ui/theme/app_theme_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/theme/app_theme.dart'; @@ -20,11 +19,13 @@ void main() { } }); - test('the Cupertino page is gray in dark mode and unchanged in light', () { + test('page backgrounds are gray in dark mode and unchanged in light', () { expect(AppColors.background.darkColor, const Color(0xFF141416)); expect(AppColors.background.color, const Color(0xFFFFFFFF)); - expect(appCupertinoTheme.scaffoldBackgroundColor, AppColors.background); - expect(AppColors.groupedBackground.darkColor, isNot(CupertinoColors.black)); + expect( + AppColors.groupedBackground.darkColor, + isNot(const Color(0xFF000000)), + ); }); test('Android pages retain native predictive Back in both themes', () { From f3d6013ef5f30d6e57e53e33fea4dd5dd91f3313 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 03:04:27 +0000 Subject: [PATCH 2/4] Remove Cupertino variants from runs sheet tests Keep the runs sheet coverage focused on the Material-only app path and remove obsolete Cupertino hosts and loop variants. --- .../features/runs/ui/runs_sheets_test.dart | 78 ++++++++----------- 1 file changed, 31 insertions(+), 47 deletions(-) diff --git a/app/test/features/runs/ui/runs_sheets_test.dart b/app/test/features/runs/ui/runs_sheets_test.dart index 973c1436..cd6f1d28 100644 --- a/app/test/features/runs/ui/runs_sheets_test.dart +++ b/app/test/features/runs/ui/runs_sheets_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -39,11 +38,7 @@ void main() { await gateway.framesController.close(); }); - Future mount( - WidgetTester tester, { - required bool cupertino, - String? createdAt, - }) async { + Future mount(WidgetTester tester, {String? createdAt}) async { tester.view.physicalSize = const Size(800, 1400); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); @@ -67,54 +62,44 @@ void main() { builder: (context, _) => RunsList(controller: controller, onSelected: (_) {}), ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: list)) - : MaterialApp(home: Scaffold(body: list)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: list))); await tester.pumpAndSettle(); } - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; + testWidgets('filter sheet has a header whose Done closes it', (tester) async { + await mount(tester); + await tester.tap(find.byKey(const ValueKey('runs.filter'))); + await tester.pumpAndSettle(); - testWidgets('$host filter sheet has a header whose Done closes it', ( - tester, - ) async { - await mount(tester, cupertino: cupertino); - await tester.tap(find.byKey(const ValueKey('runs.filter'))); - await tester.pumpAndSettle(); + expect(find.byType(AppSheetHeader), findsOneWidget); + expect( + find.descendant( + of: find.byType(AppSheetHeader), + matching: find.text(runsFilterTitle), + ), + findsOneWidget, + ); + expect(find.text('Queued'), findsOneWidget); + expect(find.text('queued'), findsNothing); + expect(find.byKey(runsFilterClearKey), findsNothing); - expect(find.byType(AppSheetHeader), findsOneWidget); - expect( - find.descendant( - of: find.byType(AppSheetHeader), - matching: find.text(runsFilterTitle), - ), - findsOneWidget, - ); - expect(find.text('Queued'), findsOneWidget); - expect(find.text('queued'), findsNothing); - expect(find.byKey(runsFilterClearKey), findsNothing); + await tester.tap(find.text('Last 7 days')); + await tester.pumpAndSettle(); + expect(controller.timeRange, 'last_7_days'); + // An active filter offers Clear in the header. + expect(find.byKey(runsFilterClearKey), findsOneWidget); - await tester.tap(find.text('Last 7 days')); - await tester.pumpAndSettle(); - expect(controller.timeRange, 'last_7_days'); - // An active filter offers Clear in the header. - expect(find.byKey(runsFilterClearKey), findsOneWidget); - - await tester.tap(find.byKey(runsFilterDoneKey)); - await tester.pumpAndSettle(); - expect(find.byKey(const ValueKey('runs.filter.sheet')), findsNothing); - // The applied chip reads in sentence case too. - expect(find.textContaining('Last 7 days'), findsOneWidget); - }); - } + await tester.tap(find.byKey(runsFilterDoneKey)); + await tester.pumpAndSettle(); + expect(find.byKey(const ValueKey('runs.filter.sheet')), findsNothing); + // The applied chip reads in sentence case too. + expect(find.textContaining('Last 7 days'), findsOneWidget); + }); testWidgets('Material single-choice groups are check rows, not checkboxes', ( tester, ) async { - await mount(tester, cupertino: false); + await mount(tester); await tester.tap(find.byKey(const ValueKey('runs.filter'))); await tester.pumpAndSettle(); @@ -139,7 +124,7 @@ void main() { }); testWidgets('Material sort opens an anchored choice menu', (tester) async { - await mount(tester, cupertino: false); + await mount(tester); await tester.tap(find.byKey(const ValueKey('runs.sort'))); await tester.pumpAndSettle(); expect(find.byKey(const ValueKey('app-choice-menu')), findsOneWidget); @@ -153,7 +138,6 @@ void main() { ) async { await mount( tester, - cupertino: false, createdAt: DateTime(2020, 1, 1).toIso8601String(), ); await tester.tap(find.byKey(const ValueKey('runs.stats'))); @@ -171,7 +155,7 @@ void main() { testWidgets('the 7-day chart shows bars over an axis when runs started', ( tester, ) async { - await mount(tester, cupertino: true); + await mount(tester); await tester.tap(find.byKey(const ValueKey('runs.stats'))); await tester.pumpAndSettle(); expect(find.byKey(const ValueKey('runs.stats.days')), findsOneWidget); From 8361322fe274b7bebb43c44ab8eec8473d5ed05b Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 03:28:34 +0000 Subject: [PATCH 3/4] Keep floating window moves pixel-stable Round fitted window frames to whole logical pixels and accumulate drag deltas from the gesture start. This prevents floating-point size noise from rebuilding window content while preserving fractional pointer movement and resizing behavior. --- app/lib/shell/windows/window_entry.dart | 50 ++++++-- app/lib/shell/windows/window_layer.dart | 50 ++++++-- app/notes/perf-round5.md | 112 +++++++++++++++++ .../shell/windows/window_rebuild_test.dart | 115 +++++++++++++++++- app/test/shell/windows/window_store_test.dart | 18 +++ 5 files changed, 325 insertions(+), 20 deletions(-) diff --git a/app/lib/shell/windows/window_entry.dart b/app/lib/shell/windows/window_entry.dart index 584c861f..83fe7afe 100644 --- a/app/lib/shell/windows/window_entry.dart +++ b/app/lib/shell/windows/window_entry.dart @@ -75,22 +75,54 @@ String windowFrameKey(String kind, String? serverKey, String contentId) => '$kind\n${serverKey ?? ''}\n$contentId'; /// [rect] moved and shrunk to fit inside [bounds], at least [minSize] where -/// the bounds allow it. +/// the bounds allow it, on whole logical pixels. +/// +/// Whole pixels keep a moved window exactly its size from frame to frame: a +/// `Rect` stores left, top, right and bottom, so shifting a frame by a +/// fractional delta makes its width differ in its last bits, and every widget +/// that reads the window's size (its `MediaQuery`) rebuilds and lays out +/// again on every pointer event. Rect fitWindowFrame(Rect rect, Size bounds, Size minSize) { - final width = rect.width - .clamp(minSize.width, double.infinity) - .clamp(0.0, bounds.width); - final height = rect.height - .clamp(minSize.height, double.infinity) - .clamp(0.0, bounds.height); + final width = _wholePixel( + rect.width.clamp(minSize.width, double.infinity).clamp(0.0, bounds.width), + minSize.width, + bounds.width, + ); + final height = _wholePixel( + rect.height + .clamp(minSize.height, double.infinity) + .clamp(0.0, bounds.height), + minSize.height, + bounds.height, + ); return Rect.fromLTWH( - rect.left.clamp(0.0, bounds.width - width), - rect.top.clamp(0.0, bounds.height - height), + _wholePixel( + rect.left.clamp(0.0, bounds.width - width), + 0, + bounds.width - width, + ), + _wholePixel( + rect.top.clamp(0.0, bounds.height - height), + 0, + bounds.height - height, + ), width, height, ); } +/// [value] rounded to a whole logical pixel and kept within +/// `[minimum, limit]`. +/// +/// A fractional [minimum] rounds up, so the whole-pixel size never drops below +/// the minimum the caller asked for; when the limit is too small to hold that, +/// the limit wins. +double _wholePixel(double value, double minimum, double limit) { + final max = limit.floorToDouble(); + final min = minimum.ceilToDouble().clamp(0.0, max); + return value.roundToDouble().clamp(min, max); +} + /// Where [entry] is drawn inside [bounds]: fitted, or filling the area less /// a margin when maximised. Rect drawnWindowFrame(WindowEntry entry, Size bounds, Size minSize) => diff --git a/app/lib/shell/windows/window_layer.dart b/app/lib/shell/windows/window_layer.dart index f17c23da..b5d93d66 100644 --- a/app/lib/shell/windows/window_layer.dart +++ b/app/lib/shell/windows/window_layer.dart @@ -106,12 +106,26 @@ class _WindowLayerState extends State /// Where the pointer is in the host while the title is dragged. Offset? _pointer; + /// The frame the current move or resize started from and the pointer delta + /// summed since. Every event sets the frame from `start + total`: fitting + /// one fractional step after another would round part of the pointer's + /// movement away each time and drift, and shifting the fitted frame would + /// change its size in its last bits. + Rect? _dragStart; + Offset _dragTotal = Offset.zero; + void _move(Offset delta, Offset globalPosition) { final box = context.findRenderObject(); _pointer = box is RenderBox ? box.globalToLocal(globalPosition) : null; + final start = _dragStart ??= _current; + _dragTotal += delta; widget.manager.setFrame( _id, - fitWindowFrame(_current.shift(delta), widget.bounds, widget.kind.minSize), + fitWindowFrame( + start.shift(_dragTotal), + widget.bounds, + widget.kind.minSize, + ), save: false, ); } @@ -121,6 +135,7 @@ class _WindowLayerState extends State void _moveEnded() { final pointer = _pointer; _pointer = null; + _endDrag(); final bounds = widget.bounds; final snap = pointer == null ? null : windowSnapFor(pointer, bounds); if (snap == WindowSnap.maximize) { @@ -145,15 +160,16 @@ class _WindowLayerState extends State } void _resize(Offset delta) { - final rect = _current; + final start = _dragStart ??= _current; + _dragTotal += delta; widget.manager.setFrame( _id, fitWindowFrame( Rect.fromLTWH( - rect.left, - rect.top, - rect.width + delta.dx, - rect.height + delta.dy, + start.left, + start.top, + start.width + _dragTotal.dx, + start.height + _dragTotal.dy, ), widget.bounds, widget.kind.minSize, @@ -162,16 +178,34 @@ class _WindowLayerState extends State ); } + void _resizeEnded() { + _endDrag(); + widget.manager.commit(_id); + } + + /// A drag ends here even if it is cancelled or another gesture begins. + void _endDrag() { + _dragStart = null; + _dragTotal = Offset.zero; + } + /// A press brings the window to the top and gives it the keyboard at /// once, before the press does anything else (focus a field, open a /// popup that takes the keyboard itself). void _pressed() { + // A new gesture measures from where it starts, even if the last drag was + // cancelled before it ended. + _endDrag(); if (!widget.focus.has(_id)) widget.focus.focusNow(_id); widget.manager.raise(_id); } ThemeData _pageThemeFor(ThemeData theme) { - if (identical(theme, _themeSource)) return _pageTheme!; + // Equal to the last theme means the same page theme, even when the app's + // animated theme hands over a new but equal `ThemeData` object: a new + // page theme would notify every content widget that reads the theme on + // every frame of a move. + if (theme == _themeSource) return _pageTheme!; _themeSource = theme; return _pageTheme = WindowNavigator.themeData(theme); } @@ -263,7 +297,7 @@ class _WindowLayerState extends State bottom: widget.bounds.height - frame.bottom, child: WindowResizeCorner( onResize: _resize, - onResizeEnd: () => manager.commit(_id), + onResizeEnd: _resizeEnded, ), ), ], diff --git a/app/notes/perf-round5.md b/app/notes/perf-round5.md index 91022c70..c00b1391 100644 --- a/app/notes/perf-round5.md +++ b/app/notes/perf-round5.md @@ -100,3 +100,115 @@ this scenario, not content. (`drag=483,523>120,80`), and a page pushed inside a window (click `page`) then dragged: the content must follow the window, stay inside it, and show no stale or clipped frame. + +## Whole-pixel frames + +Follow-up: after the change above, a drag still built and laid out every +window's content on every pointer event (14-17 ms of build per frame in the +browser bench). A `Rect` stores left, top, right and bottom, so shifting a +fractional frame changes its width in the last bits (`360.00000000000006`), and +`WindowPageBox` puts that size in a `MediaQuery`: every `MediaQuery` dependent +rebuilt and laid out again on every move. The layer also regenerated its page +theme on every frame, because Material's animated theme hands over a new but +equal `ThemeData` object and `_pageThemeFor` compared with `identical`, so every +theme dependent rebuilt too. + +### Change + +`lib/shell/windows/`: + +- `window_entry.dart`: `fitWindowFrame` rounds left, top, width and height to + whole logical pixels after clamping, keeping the frame inside the bounds and + at the minimum size. A fractional minimum rounds up, so a whole-pixel frame is + never smaller than the minimum the kind asked for (the bounds still win when + they cannot hold it). Whole numbers add and subtract exactly, so a moved + window keeps exactly its size. +- `window_layer.dart`: `_WindowLayerState` remembers the frame a move or resize + started from and the pointer delta summed since, and sets the frame from + `start + total` on every event, so rounding one fractional step after another + cannot lose part of the pointer's movement or drift. The drag state is + cleared in `_moveEnded`, in the corner's `onPanEnd` (`_resizeEnded`, which + still calls `manager.commit`) and on pointer down. +- `window_layer.dart`: `_pageThemeFor` reuses the cached page theme when the app + theme is `==` to the last one, not only identical, so an equal theme from an + animation does not notify every content widget. + +Snapping, `manager.commit`, `windowSnapRect` (still fractional where the bounds +are) and a maximised frame are unchanged. + +### Tests + +`test/shell/windows/window_rebuild_test.dart`: + +- dragging a title by eight `Offset(10.3, 4.7)` moves with + `debugOnRebuildDirtyWidget` (reset in a `finally`): no `TextButton`, + `ListView` or `Scrollable` element inside either window's content rebuilds, + the `WindowFrame` size stays exactly `360x420` after every move, and the + window ends within 1 px of `start + 8 x (10.3, 4.7)` (`100,80` -> `182,118`); +- resizing by five `Offset(-10.3, -6.7)` moves: every frame is a whole-pixel + size, the other window does not rebuild, and the resized window's content + rebuilds with the new `MediaQuery` size (within 1 px of + `360x420 - 5 x (10.3, 6.7)`). + +`test/shell/windows/window_store_test.dart` also pins the fit: a fractional +minimum (`320.1x240.4`) yields a whole-pixel `321x241` frame, and bounds smaller +than that minimum (`319.6x239.2`) yield `319x239` instead of exceeding the area. + +Against the old lib (lib/shell/windows changes stashed, tests unchanged): 2 +failed - the drag rebuilt `ListView`, `Scrollable` and `TextButton` at move 1, +and the first resize move gave a fractional `349.70000000000005` width. The new +code passes all 5. + +### Browser bench + +Built after (`build/probe-app`) and before (`build/probe-before`, lib change +stashed): + +``` +/Users/alan/development/flutter/bin/flutter build web \ + --target tool/search_selection_probe_entry.dart --output build/probe-app +/Users/alan/development/flutter/bin/flutter build web \ + --target tool/search_selection_probe_entry.dart --output build/probe-before +``` + +Then, from `app/`: + +``` +node tool/perf/interaction_bench.mjs --build build/probe-before --out /tmp/bench \ + --gpu --repeat 3 --only 'desktop: drag a probe window' +node tool/perf/interaction_bench.mjs --build build/probe-app --out /tmp/bench \ + --gpu --repeat 3 --only 'desktop: drag a probe window' +``` + +The machine was shared with other pipeline test runs (load average 11.8-75.7 +during the rounds; `ms/frame = buildSum / frames`): + +| round | load | code | frames | buildSum | ms/frame | buildMax | longest | over16 | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | +| 1 | 22.1 | before | 54 | 995.1 | 18.4 | 77.8 | 80.4 | 29 | +| 1 | 22.1 | after | 42 | 419.2 | 10.0 | 25.8 | 30.3 | 11 | +| 2 | 11.8 | before | 51 | 489.8 | 9.6 | 20.2 | 22.4 | 3 | +| 2 | 11.8 | after | 42 | 549.8 | 13.1 | 44.4 | 59.7 | 14 | +| 3 | 75.7 | before | 48 | 4590.1 | 95.6 | 320.0 | 437.1 | 44 | +| 3 | 75.7 | after | 42 | 1741.3 | 41.5 | 136.3 | 148.9 | 36 | + +The browser numbers stay indicative on this loaded machine: round 2 has the +before build ahead, while rounds 1 and 3 (including the heavily loaded one) +show the after build at about half the build time per frame. The deterministic +result is the widget test: a fractional drag no longer rebuilds any content, +and the window size is bit-identical from frame to frame. + +### Checks + +- `tool/memwatch/full.sh 'test/shell/windows test/features/chat/chat_floating_pane_test.dart test/features/terminal'`: + 121 passed, 0 failed. +- `tool/analyze.sh`: clean. + +### Affected UI states (for ui-review) + +`/runs?windows=2` at 1280x800 light: drag the top window by its title +(`drag=250,132>301,153`), then resize it by its corner: the title bar, body and +edges must stay aligned with no gap or overlap of a pixel, the content must not +reflow during the drag, and the resize corner must stay on the window's lower +right corner. + diff --git a/app/test/shell/windows/window_rebuild_test.dart b/app/test/shell/windows/window_rebuild_test.dart index dcbf9252..11058b00 100644 --- a/app/test/shell/windows/window_rebuild_test.dart +++ b/app/test/shell/windows/window_rebuild_test.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/shell/windows/window_entry.dart'; +import 'package:pipelines_app/shell/windows/window_frame.dart'; import 'package:pipelines_app/shell/windows/window_kind.dart'; import 'package:pipelines_app/shell/windows/window_layer.dart'; import 'package:pipelines_app/shell/windows/window_manager.dart'; @@ -36,6 +37,23 @@ void main() { ProbeContentState content(WidgetTester tester, String id) => tester.state(find.byKey(ValueKey('content-$id'))); + Size windowSize(WidgetTester tester, String title) => tester.getSize( + find.ancestor(of: find.text(title), matching: find.byType(WindowFrame)), + ); + + /// The elements inside the probe windows that depend on the window's size: + /// its buttons and the scroll view around them. + Set contentElements() => { + for (final id in const ['a', 'b']) + for (final type in const [TextButton, ListView, Scrollable]) + ...find + .descendant( + of: find.byKey(ValueKey('content-$id')), + matching: find.byType(type), + ) + .evaluate(), + }; + Future openTwo(WidgetTester tester) async { manager.open('probe', 'a', frame: const Rect.fromLTWH(100, 80, 360, 420)); manager.open('probe', 'b', frame: const Rect.fromLTWH(600, 200, 360, 420)); @@ -77,6 +95,99 @@ void main() { expect(content(tester, 'b').builds, beforeB); }); + testWidgets('a fractional title drag keeps the window size exactly and does ' + 'not rebuild content', (tester) async { + await openTwo(tester); + final start = windowRect(tester, 'Probe a').topLeft; + final startSize = windowSize(tester, 'Probe a'); + final watched = contentElements(); + expect(watched, isNotEmpty); + final rebuilt = {}; + final gesture = await tester.startGesture( + tester.getCenter( + inWindow('Probe a', find.byKey(const ValueKey('window-title'))), + ), + ); + // The press raises and focuses the window before the drag starts; only + // the drag's own rebuilds are watched. + await tester.pump(); + debugOnRebuildDirtyWidget = (element, builtOnce) { + if (watched.contains(element)) rebuilt.add(element); + }; + try { + final a = content(tester, 'a'); + final b = content(tester, 'b'); + final beforeA = a.builds; + final beforeB = b.builds; + for (var i = 0; i < 8; i++) { + await gesture.moveBy(const Offset(10.3, 4.7)); + await tester.pump(); + expect( + rebuilt.map((e) => e.widget.runtimeType).toSet(), + isEmpty, + reason: 'window content rebuilt at move $i', + ); + expect( + windowSize(tester, 'Probe a'), + startSize, + reason: 'window size changed at move $i', + ); + } + await gesture.up(); + await tester.pumpAndSettle(); + expect(rebuilt, isEmpty); + expect(a.builds, beforeA); + expect(b.builds, beforeB); + // Eight fractional moves, rounded to whole pixels, without drift. + final moved = windowRect(tester, 'Probe a').topLeft - start; + expect(moved.dx, closeTo(8 * 10.3, 1)); + expect(moved.dy, closeTo(8 * 4.7, 1)); + } finally { + debugOnRebuildDirtyWidget = null; + } + }); + + testWidgets('resizing by fractional deltas gives whole-pixel sizes', ( + tester, + ) async { + await openTwo(tester); + final a = content(tester, 'a'); + final b = content(tester, 'b'); + final beforeA = a.builds; + final beforeB = b.builds; + final startSize = windowSize(tester, 'Probe b'); + final startBody = b.lastSize!; + final titleHeight = startSize.height - startBody.height; + final gesture = await tester.startGesture( + tester.getCenter( + inWindow('Probe b', find.byKey(const ValueKey('window-resize'))), + ), + ); + for (var i = 0; i < 5; i++) { + await gesture.moveBy(const Offset(-10.3, -6.7)); + await tester.pump(); + final size = windowSize(tester, 'Probe b'); + expect(size.width, size.width.roundToDouble(), reason: 'move $i width'); + expect( + size.height, + size.height.roundToDouble(), + reason: 'move $i height', + ); + expect(a.builds, beforeA, reason: 'other window rebuilt at move $i'); + } + await gesture.up(); + await tester.pumpAndSettle(); + expect(content(tester, 'a').builds, beforeA); + final state = content(tester, 'b'); + expect(state.builds, greaterThan(beforeB)); + final size = windowSize(tester, 'Probe b'); + expect(size.width, closeTo(startSize.width - 5 * 10.3, 1)); + expect(size.height, closeTo(startSize.height - 5 * 6.7, 1)); + // The content saw the new, whole-pixel size. + expect(state.lastSize!.width, size.width); + expect(state.lastSize!.height, size.height - titleHeight); + }); + testWidgets('resizing a window keeps another window and sees the new size', ( tester, ) async { @@ -108,9 +219,7 @@ void main() { testWidgets('content still rebuilds when its window is retargeted', ( tester, ) async { - manager = WindowManager( - kinds: WindowKinds()..register(_StableProbeKind()), - ); + manager = WindowManager(kinds: WindowKinds()..register(_StableProbeKind())); final entry = manager.open('stable', 'a'); await pumpProbe(tester, manager); final state = tester.state( diff --git a/app/test/shell/windows/window_store_test.dart b/app/test/shell/windows/window_store_test.dart index 7250c6e7..a0175dca 100644 --- a/app/test/shell/windows/window_store_test.dart +++ b/app/test/shell/windows/window_store_test.dart @@ -162,6 +162,24 @@ void main() { ), const Rect.fromLTWH(0, 0, 300, 200), ); + // A fractional minimum is never rounded below itself: the whole-pixel + // frame rounds up, and when the bounds cannot hold it the bounds win. + expect( + fitWindowFrame( + const Rect.fromLTWH(0, 0, 320.1, 240.4), + const Size(1000, 800), + const Size(320.1, 240.4), + ), + const Rect.fromLTWH(0, 0, 321, 241), + ); + expect( + fitWindowFrame( + const Rect.fromLTWH(0, 0, 320.1, 240.4), + const Size(319.6, 239.2), + const Size(320.1, 240.4), + ), + const Rect.fromLTWH(0, 0, 319, 239), + ); const entry = WindowEntry( id: 'w', kind: 'chat', From 1b7da4106ce952b27c71d6d186cc5ce8fc4bd2c9 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 03:47:13 +0000 Subject: [PATCH 4/4] Remove Cupertino search branches Keep the Material-only search implementation while preserving public signatures and required icon fallback parameters. --- app/lib/features/search/search_screen.dart | 49 ++---- .../search/ui/cupertino_search_body.dart | 142 ------------------ .../search/ui/search_bar_controls.dart | 72 +-------- .../search/ui/search_bounds_note.dart | 24 +-- .../features/search/ui/search_result_row.dart | 20 +-- .../search/ui/search_result_slivers.dart | 2 +- 6 files changed, 28 insertions(+), 281 deletions(-) delete mode 100644 app/lib/features/search/ui/cupertino_search_body.dart diff --git a/app/lib/features/search/search_screen.dart b/app/lib/features/search/search_screen.dart index 33be1b1c..a0965ef8 100644 --- a/app/lib/features/search/search_screen.dart +++ b/app/lib/features/search/search_screen.dart @@ -1,14 +1,11 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../core/api_gateway.dart'; import '../../shell/shell_bar.dart'; import '../../shell/shell_search_focus.dart'; -import '../../ui/adaptive/host.dart'; import '../../ui/adaptive/segmented_bar.dart'; import 'data/search_repository.dart'; import 'domain/search_controller.dart'; -import 'ui/cupertino_search_body.dart'; import 'ui/material_search_body.dart'; import 'ui/search_bar_controls.dart'; import 'ui/search_bounds_note.dart'; @@ -31,8 +28,7 @@ class SearchScreen extends StatefulWidget { final ApiGateway gateway; final ValueChanged onOpen; - /// Lets the shell state the surface it composed. When omitted, iOS/macOS use - /// Cupertino controls and every other platform uses Material. + /// Retained for the shell's surface contract; search is Material-only. final bool? cupertino; /// True as the Search tab: the controls go into the shell's bar. @@ -127,39 +123,33 @@ class _SearchScreenState extends State { ); Widget _build(BuildContext context) { - // Follow the actual host app class: Cupertino only under an explicit - // Cupertino host, Material on every platform otherwise. - final cupertino = widget.cupertino ?? usesCupertinoHost(context); if (widget.embedded) { // The shell's bar carries the controls; without a shell (a bare embed) // they lead the results instead. if (!ShellBar.available(context)) { - return _body(cupertino, controls: _controls(cupertino)); + return _body(controls: _controls()); } // The field takes the title's place and fills the bar. return ShellBar( - titleWidget: _controls(cupertino), - child: _body(cupertino), + titleWidget: _controls(), + child: _body(), ); } final bar = SegmentedBar( - cupertino: cupertino, + cupertino: false, title: 'Search', - titleWidget: _controls(cupertino), + titleWidget: _controls(), ); - if (cupertino) { - return CupertinoPageScaffold(navigationBar: bar, child: _body(cupertino)); - } return Scaffold( extendBodyBehindAppBar: true, appBar: bar, - body: _body(cupertino), + body: _body(), ); } - Widget _controls(bool cupertino) => SearchBarControls( + Widget _controls() => SearchBarControls( focusNode: _focus, - cupertino: cupertino, + cupertino: false, text: _text, kind: _controller.parsed.kind, onChanged: _controller.updateQuery, @@ -189,24 +179,17 @@ class _SearchScreenState extends State { /// No top safe area: the results run behind the floating bar and the /// scroll view starts them below it. - Widget _body(bool cupertino, {Widget? controls}) { + Widget _body({Widget? controls}) { final header = _header(controls: controls); return SearchArtifactScope( gateway: widget.gateway, onOpen: widget.onOpen, - child: cupertino - ? CupertinoSearchBody( - controller: _controller, - query: _controller.parsed.query, - onOpen: widget.onOpen, - header: header, - ) - : MaterialSearchBody( - controller: _controller, - query: _controller.parsed.query, - onOpen: widget.onOpen, - header: header, - ), + child: MaterialSearchBody( + controller: _controller, + query: _controller.parsed.query, + onOpen: widget.onOpen, + header: header, + ), ); } } diff --git a/app/lib/features/search/ui/cupertino_search_body.dart b/app/lib/features/search/ui/cupertino_search_body.dart deleted file mode 100644 index 7777883d..00000000 --- a/app/lib/features/search/ui/cupertino_search_body.dart +++ /dev/null @@ -1,142 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -import '../../../core/api_gateway.dart'; -import '../domain/search_controller.dart'; -import 'search_result_slivers.dart'; -import 'search_layout.dart'; - -/// The Cupertino search view: an optional status header and the shared list -/// rows in one scroll view that runs behind the top bar, with standard -/// activity and retry controls. -class CupertinoSearchBody extends StatelessWidget { - const CupertinoSearchBody({ - super.key, - required this.controller, - required this.query, - required this.onOpen, - required this.header, - }); - - final OmniSearchController controller; - final String query; - final ValueChanged onOpen; - final Widget header; - - @override - Widget build(BuildContext context) { - return SearchScrollView( - slivers: [ - SliverToBoxAdapter(child: header), - if (controller.showProgress) - const SliverToBoxAdapter( - child: Padding( - padding: EdgeInsets.symmetric(vertical: 8), - child: CupertinoActivityIndicator(), - ), - ), - ..._content(context), - ], - ); - } - - List _content(BuildContext context) { - switch (controller.bodyKind) { - case SearchBodyKind.error: - return [ - SliverFillRemaining( - hasScrollBody: false, - child: _CupertinoError( - message: controller.error!, - onRetry: controller.retry, - ), - ), - ]; - case SearchBodyKind.searching: - return const [ - SliverFillRemaining( - hasScrollBody: false, - child: _CupertinoSearching(), - ), - ]; - case SearchBodyKind.results: - return searchResultSlivers( - controller: controller, - query: query, - onOpen: onOpen, - cupertino: true, - message: (text) => _CupertinoMessage(message: text), - ); - case SearchBodyKind.empty: - return [ - SliverToBoxAdapter( - child: _CupertinoMessage(message: controller.emptyMessage!), - ), - ]; - case SearchBodyKind.idle: - return const [ - SliverFillRemaining( - hasScrollBody: false, - child: _CupertinoMessage( - message: 'Search pipelines, runs, artifacts and chats.', - ), - ), - ]; - } - } -} - -class _CupertinoSearching extends StatelessWidget { - const _CupertinoSearching(); - - @override - Widget build(BuildContext context) => const Center( - child: Padding( - padding: EdgeInsets.all(24), - child: Column( - mainAxisSize: MainAxisSize.min, - spacing: 12, - children: [CupertinoActivityIndicator(), Text('Searching…')], - ), - ), - ); -} - -class _CupertinoMessage extends StatelessWidget { - const _CupertinoMessage({required this.message}); - - final String message; - - @override - Widget build(BuildContext context) => Center( - child: Padding( - padding: const EdgeInsets.all(24), - child: Text(message, textAlign: TextAlign.center), - ), - ); -} - -class _CupertinoError extends StatelessWidget { - const _CupertinoError({required this.message, required this.onRetry}); - - final String message; - final Future Function() onRetry; - - @override - Widget build(BuildContext context) => Center( - child: Padding( - padding: const EdgeInsets.all(24), - child: Column( - mainAxisSize: MainAxisSize.min, - spacing: 12, - children: [ - Text(message, textAlign: TextAlign.center), - CupertinoButton.filled( - key: const ValueKey('search.retry'), - onPressed: onRetry, - child: const Text('Retry'), - ), - ], - ), - ), - ); -} diff --git a/app/lib/features/search/ui/search_bar_controls.dart b/app/lib/features/search/ui/search_bar_controls.dart index 12a01d69..bb5908be 100644 --- a/app/lib/features/search/ui/search_bar_controls.dart +++ b/app/lib/features/search/ui/search_bar_controls.dart @@ -59,7 +59,7 @@ class SearchBarControls extends StatelessWidget { autofocus: autofocus, focusNode: focusNode, inBar: true, - cupertino: cupertino, + cupertino: false, placeholder: 'Search pipelines, runs, artifacts and chats', onChanged: onChanged, onSubmitted: (_) => onSubmitted(), @@ -67,14 +67,14 @@ class SearchBarControls extends StatelessWidget { ), ), ), - SearchKindButton(cupertino: cupertino, kind: kind, onSelected: onKind), + SearchKindButton(cupertino: false, kind: kind, onSelected: onKind), BarIconButton( key: searchHelpKey, - cupertino: cupertino, + cupertino: false, icon: Icons.info_outline, cupertinoIcon: CupertinoIcons.info_circle, label: 'Search syntax', - onPressed: () => showSearchHelp(context, cupertino: cupertino), + onPressed: () => showSearchHelp(context, cupertino: false), ), ], ), @@ -100,31 +100,6 @@ class SearchKindButton extends StatelessWidget { @override Widget build(BuildContext context) { final narrowed = kind != SearchKind.all; - if (cupertino) { - final icon = Icon( - narrowed - ? CupertinoIcons.line_horizontal_3_decrease_circle_fill - : CupertinoIcons.line_horizontal_3_decrease_circle, - ); - return Semantics( - button: true, - label: _label, - excludeSemantics: true, - child: CupertinoButton( - key: searchKindKey, - padding: EdgeInsets.symmetric(horizontal: narrowed ? 8 : 0), - minimumSize: const Size.square(kMinInteractiveDimensionCupertino), - onPressed: () => _pickCupertino(context), - child: narrowed - ? Row( - mainAxisSize: MainAxisSize.min, - spacing: 4, - children: [icon, Text(kind.label)], - ) - : icon, - ), - ); - } return PopupMenuButton( key: searchKindKey, tooltip: _label, @@ -153,49 +128,10 @@ class SearchKindButton extends StatelessWidget { ), ); } - - Future _pickCupertino(BuildContext context) async { - final selected = await showCupertinoModalPopup( - context: context, - builder: (context) => CupertinoActionSheet( - title: const Text('Kind'), - actions: [ - for (final value in SearchKind.values) - CupertinoActionSheetAction( - onPressed: () => Navigator.pop(context, value), - isDefaultAction: value == kind, - child: Text(value.label), - ), - ], - cancelButton: CupertinoActionSheetAction( - onPressed: () => Navigator.pop(context), - child: const Text('Cancel'), - ), - ), - ); - if (selected != null) onSelected(selected); - } } /// The query syntax, on demand instead of a paragraph above the results. Future showSearchHelp(BuildContext context, {required bool cupertino}) { - if (cupertino) { - return showCupertinoDialog( - context: context, - barrierDismissible: true, - builder: (context) => CupertinoAlertDialog( - title: const Text('Search syntax'), - content: const Text(searchTokenHint), - actions: [ - CupertinoDialogAction( - isDefaultAction: true, - onPressed: () => Navigator.pop(context), - child: const Text('OK'), - ), - ], - ), - ); - } return showDialog( context: context, builder: (context) => AlertDialog( diff --git a/app/lib/features/search/ui/search_bounds_note.dart b/app/lib/features/search/ui/search_bounds_note.dart index baac9213..18c9e442 100644 --- a/app/lib/features/search/ui/search_bounds_note.dart +++ b/app/lib/features/search/ui/search_bounds_note.dart @@ -1,8 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; - const searchBoundsKey = ValueKey('search.bounds'); /// The server's note that a result set was cut short, in the host's muted @@ -14,22 +11,11 @@ class SearchBoundsNote extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final TextStyle? style; - final IconData icon; - if (cupertino) { - icon = CupertinoIcons.info_circle; - style = CupertinoTheme.of(context).textTheme.textStyle.copyWith( - fontSize: 13, - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - } else { - icon = Icons.info_outline; - final theme = Theme.of(context); - style = theme.textTheme.bodySmall?.copyWith( - color: theme.colorScheme.onSurfaceVariant, - ); - } + const icon = Icons.info_outline; + final theme = Theme.of(context); + final style = theme.textTheme.bodySmall?.copyWith( + color: theme.colorScheme.onSurfaceVariant, + ); return Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: Row( diff --git a/app/lib/features/search/ui/search_result_row.dart b/app/lib/features/search/ui/search_result_row.dart index b1668066..7f6b03f3 100644 --- a/app/lib/features/search/ui/search_result_row.dart +++ b/app/lib/features/search/ui/search_result_row.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; @@ -36,16 +35,12 @@ class SearchResultRow extends StatelessWidget { final kind = '${hit['kind'] ?? ''}'; return AppListRow( key: ValueKey('search.result.${hit['target']}'), - cupertino: cupertino, + cupertino: false, divider: divider, onTap: row.openable ? () => onOpen(hit) : null, leading: searchArtifactThumbnail(context, hit) ?? - AppListAvatar( - child: Icon( - cupertino ? searchCupertinoIcon(kind) : searchMaterialIcon(kind), - ), - ), + AppListAvatar(child: Icon(searchMaterialIcon(kind))), title: Text(row.title), time: row.recency, subtitle: kind == 'chat' && row.snippet != null @@ -109,14 +104,3 @@ IconData searchMaterialIcon(String kind) => switch (kind) { 'chat' => Icons.chat_bubble_outline, _ => Icons.help_outline, }; - -IconData searchCupertinoIcon(String kind) => switch (kind) { - 'pipeline' => CupertinoIcons.arrow_branch, - 'version' => CupertinoIcons.square_stack_3d_up, - 'run' => CupertinoIcons.play_circle, - 'step' => CupertinoIcons.arrow_right, - 'field' => CupertinoIcons.doc_text, - 'artifact' => CupertinoIcons.paperclip, - 'chat' => CupertinoIcons.chat_bubble, - _ => CupertinoIcons.question_circle, -}; diff --git a/app/lib/features/search/ui/search_result_slivers.dart b/app/lib/features/search/ui/search_result_slivers.dart index db7ca888..3c926426 100644 --- a/app/lib/features/search/ui/search_result_slivers.dart +++ b/app/lib/features/search/ui/search_result_slivers.dart @@ -32,7 +32,7 @@ List searchResultSlivers({ hit: hits[index], query: query, onOpen: onOpen, - cupertino: cupertino, + cupertino: false, divider: index < hits.length - 1, ), );