diff --git a/app/lib/features/search/search_screen.dart b/app/lib/features/search/search_screen.dart index 18a7d663..cff61b14 100644 --- a/app/lib/features/search/search_screen.dart +++ b/app/lib/features/search/search_screen.dart @@ -98,7 +98,6 @@ class _SearchScreenState extends State { // The field takes the title's place and fills the bar. return ShellBar( titleWidget: _controls(cupertino), - titleWidgetMaxWidth: kSearchPillMaxWidth, child: _body(cupertino), ); } @@ -106,7 +105,6 @@ class _SearchScreenState extends State { cupertino: cupertino, title: 'Search', titleWidget: _controls(cupertino), - titleWidgetMaxWidth: kSearchPillMaxWidth, ); if (cupertino) { return CupertinoPageScaffold(navigationBar: bar, child: _body(cupertino)); diff --git a/app/lib/features/search/ui/search_bar_controls.dart b/app/lib/features/search/ui/search_bar_controls.dart index 4f552d18..aeeb2f89 100644 --- a/app/lib/features/search/ui/search_bar_controls.dart +++ b/app/lib/features/search/ui/search_bar_controls.dart @@ -4,17 +4,12 @@ import 'package:flutter/material.dart'; import '../../../ui/input/app_search_field.dart'; import '../../../ui/navigation/bar_icon_button.dart'; import '../domain/search_models.dart'; -import 'search_layout.dart'; const searchFieldKey = ValueKey('search.field'); const searchKindKey = ValueKey('search.kind'); const searchHelpKey = ValueKey('search.help'); const searchBarControlsKey = ValueKey('search.bar'); -/// The widest the search pill grows on a wide window: the result column's -/// width, so on a wide window the field and the results share both edges. -const double kSearchPillMaxWidth = kSearchContentMaxWidth; - const searchTokenHint = 'Filter with t:pipeline or type:artifact (pipeline, run, step, field, ' 'artifact, version). Last type wins; choosing Kind replaces it. Quote ' @@ -46,9 +41,10 @@ class SearchBarControls extends StatelessWidget { final bool autofocus; @override - Widget build(BuildContext context) => ConstrainedBox( + // The pill grows with the bar, so the field and the results share both + // edges at every width. + Widget build(BuildContext context) => KeyedSubtree( key: searchBarControlsKey, - constraints: const BoxConstraints(maxWidth: kSearchPillMaxWidth), child: Row( children: [ Expanded( diff --git a/app/lib/features/search/ui/search_layout.dart b/app/lib/features/search/ui/search_layout.dart index e7a79f53..2489d0aa 100644 --- a/app/lib/features/search/ui/search_layout.dart +++ b/app/lib/features/search/ui/search_layout.dart @@ -2,16 +2,13 @@ import 'package:flutter/widgets.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; -/// The widest the result column grows on a wide window. -const double kSearchContentMaxWidth = 840; - /// The bar's own side inset, so the column starts under the title pill. const double kSearchContentInset = 12; /// Search's scroll view: it runs behind the floating top bar (the first item /// starts below the bar's height, read from the media padding), ends clear of -/// a floating tab bar, and keeps each sliver to a start-aligned column no -/// wider than [kSearchContentMaxWidth]. +/// a floating tab bar, and spans each sliver across the whole pane between +/// the bar's own side insets, at every width. class SearchScrollView extends StatelessWidget { const SearchScrollView({super.key, required this.slivers}); @@ -29,10 +26,7 @@ class SearchScrollView extends StatelessWidget { start: kSearchContentInset + padding.left, end: kSearchContentInset + padding.right, ), - sliver: SliverConstrainedCrossAxis( - maxExtent: kSearchContentMaxWidth, - sliver: sliver, - ), + sliver: sliver, ), const SliverFloatingBarClearance(), ], diff --git a/app/notes/width-stage-search.md b/app/notes/width-stage-search.md new file mode 100644 index 00000000..e6d76c28 --- /dev/null +++ b/app/notes/width-stage-search.md @@ -0,0 +1,19 @@ +# Stage page and Search width on a Fold / wide web + +Captures: /tmp/width-evidence/{before,after}-{stage,search,run}-{material,cupertino}-{880x1000,1100x800,1400x900}.png, +from the real `PipelinesApp` probe (`tool/search_selection_probe_entry.dart`) served by +`python3 -m http.server`. The entry now takes `?route=/runs/7/stage/build%3Fvisit%3D1` +(opens a deep app location from a plain file server) and `?q=release` (types into Search). + +- Search: the result column was capped at `kSearchContentMaxWidth` (840) by a + `SliverConstrainedCrossAxis`, and the bar pill at the same cap, leaving the right + of the window empty at 1100/1400. Both caps are removed: results and pill span the + pane between the bar's 12 px insets. +- Stage page: already fills the detail pane edge to edge in every capture (no + ContentWidth/Center/ConstrainedBox in the visit page; the run_detail_tabs header + ConstrainedBox limits height only). `test/shell/split_stage_page_width_test.dart` + locks this at 880 and 1400. The pane itself is the shell's 60% list/detail split; + making the stage page cover the list is a shell policy decision, not changed here. +- Headless Chrome's virtual time stops the Cupertino page push mid-transition, so + the Cupertino stage captures show the slide in progress; the widget test covers + the settled layout. diff --git a/app/test/features/search/search_bar_layout_test.dart b/app/test/features/search/search_bar_layout_test.dart index efa97f1d..f102e556 100644 --- a/app/test/features/search/search_bar_layout_test.dart +++ b/app/test/features/search/search_bar_layout_test.dart @@ -146,18 +146,14 @@ void main() { 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)); - // Start-aligned under the bar's inset, no wider than the cap. + // 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, greaterThanOrEqualTo(kSearchContentInset)); - expect(rect.right, lessThanOrEqualTo(kSearchContentInset + 840)); - // The search pill keeps to its own cap on a wide window. - expect( - tester.getSize(find.byKey(searchBarControlsKey)).width, - lessThanOrEqualTo(kSearchPillMaxWidth), - ); + expect(rect.left, kSearchContentInset); + expect(rect.right, 1200 - kSearchContentInset); }); - for (final width in [390.0, 1200.0]) { + 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); @@ -188,16 +184,12 @@ void main() { find.descendant(of: bar, matching: find.byType(GlassPill)), ); expect(pill.left, kSearchContentInset); - expect( - pill.width, - width - 2 * kSearchContentInset < kSearchPillMaxWidth - ? width - 2 * kSearchContentInset - : kSearchPillMaxWidth, - ); + // 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. + // 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')), ); diff --git a/app/test/shell/split_stage_page_width_test.dart b/app/test/shell/split_stage_page_width_test.dart new file mode 100644 index 00000000..795ce7e2 --- /dev/null +++ b/app/test/shell/split_stage_page_width_test.dart @@ -0,0 +1,112 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/features/runs/data/runs_repository.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; +import 'package:pipelines_app/features/runs/ui/runs_controller.dart'; +import 'package:pipelines_app/shell/adaptive_shell.dart'; +import 'package:pipelines_app/shell/destination.dart'; +import 'package:pipelines_app/shell/detail_page.dart'; +import 'package:pipelines_app/shell/list_detail.dart'; +import 'package:pipelines_app/ui/layout/sticky_section.dart'; + +import '../features/runs/ui/run_detail_graph_support.dart'; +import '../features/runs/ui/run_detail_visit_support.dart'; + +/// The stage page opened from a run's Timeline fills the detail pane edge to +/// edge at an unfolded foldable's width and on a wide window: its content +/// spans the pane minus the page's own padding, with no reading-width cap. +void main() { + Future openStagePage( + WidgetTester tester, { + required bool cupertino, + required Size size, + }) async { + tester.view.physicalSize = size; + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final gateway = RunDetailFakeGateway(visitRunFixture()); + final controller = RunsController(RunsRepository(gateway)); + addTearDown(controller.dispose); + await controller.select(77); + final shell = AdaptiveShell( + cupertino: cupertino, + destination: AppDestination.runs, + destinationBodies: { + AppDestination.runs: (_) => ListDetailPanes( + list: ListView(children: const [Text('run row 0')]), + detail: DetailPane( + destination: AppDestination.runs, + implyBack: false, + builder: (_) => RunDetailView( + controller: controller, + gateway: gateway, + onBack: () {}, + ), + ), + ), + }, + ); + await tester.pumpWidget( + cupertino + ? CupertinoApp(home: shell) + : MaterialApp( + theme: ThemeData(platform: TargetPlatform.android), + home: shell, + ), + ); + await tester.pumpAndSettle(); + await openRunDetailTab(tester, RunDetailTab.timeline); + final row = find.byKey(const ValueKey('run-timeline-visit-1')); + await tester.ensureVisible(row); + await tester.pumpAndSettle(); + await tester.tap(row); + await tester.pumpAndSettle(); + } + + for (final cupertino in [false, true]) { + final host = cupertino ? 'Cupertino' : 'Material'; + for (final size in const [Size(880, 1000), Size(1400, 900)]) { + testWidgets('$host ${size.width.toInt()}: the stage page spans the ' + 'detail pane edge to edge', (tester) async { + await openStagePage(tester, cupertino: cupertino, size: size); + expect(find.byKey(const Key('run-visit-back')), findsOneWidget); + final body = tester.getRect( + find.byKey(const ValueKey('list-detail-body')), + ); + // The pane is the detail's whole share of the window, up to its + // right edge. + expect(body.right, size.width); + final pane = tester.getRect(find.byKey(const Key('run-visit-pane'))); + expect(pane.left, body.left); + expect(pane.right, body.right); + // The facts block and the Input and Output sections span the whole + // pane; only the page's own padding insets their content. + final facts = tester.getRect(find.byKey(const Key('run-visit-facts'))); + expect(facts.left, body.left); + expect(facts.right, body.right); + final titles = find.descendant( + of: find.byKey(const Key('run-visit-pane')), + matching: find.byType(StickySectionTitle), + ); + expect(titles, findsNWidgets(2)); + for (final title in tester.widgetList(titles)) { + final rect = tester.getRect(find.byWidget(title)); + expect(rect.left, body.left); + expect(rect.right, body.right); + } + // The heading starts at the page padding and the chevron ends at it. + final input = tester.getRect( + find.descendant(of: titles.first, matching: find.text('Input')), + ); + expect(input.left, body.left + 16); + final chevron = tester.getRect( + find.descendant(of: titles.first, matching: find.byType(Icon)).last, + ); + expect(chevron.right, closeTo(body.right - 8, 0.5)); + expect(tester.takeException(), isNull); + }); + } + } +} diff --git a/app/tool/search_selection_probe_entry.dart b/app/tool/search_selection_probe_entry.dart index 6c0a6d0e..06826705 100644 --- a/app/tool/search_selection_probe_entry.dart +++ b/app/tool/search_selection_probe_entry.dart @@ -20,7 +20,11 @@ import 'package:pipelines_app/application/pipelines_app.dart'; import 'package:pipelines_app/application/server_endpoint.dart'; import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/transport/pipelines_client.dart'; +import 'package:pipelines_app/features/search/ui/search_bar_controls.dart' + show searchFieldKey; +import 'package:pipelines_app/ui/input/app_search_field.dart'; import 'package:flutter/widgets.dart'; +import 'package:web/web.dart' as web; import 'package:web_socket_channel/web_socket_channel.dart'; /// The run every run-scoped hit names. Its recorded sequences are deliberately @@ -122,7 +126,8 @@ List probePipelines() => [ }, ]; -const _releaseSource = 'name: Release train\n' +const _releaseSource = + 'name: Release train\n' 'stages:\n' ' plan:\n' ' type: model\n' @@ -147,7 +152,11 @@ JsonMap probePipelineDetail(int id, int requestedVersion) { 'source': _releaseSource, 'versions': [ for (var v = 1; v <= latest; v++) - {'version': v, 'stages': summary['stages'], 'created_at': '2026-10-0${v}T10:00:00'}, + { + 'version': v, + 'stages': summary['stages'], + 'created_at': '2026-10-0${v}T10:00:00', + }, ], }; } @@ -167,7 +176,12 @@ const List<({String haystack, JsonMap hit})> probeHits = [ 'target': 'pipeline:24', 'score': 3, 'recency': '2026-10-20T09:18:00Z', - 'pipeline': {'id': 24, 'name': 'Release train', 'version': 5, 'stages': 2}, + 'pipeline': { + 'id': 24, + 'name': 'Release train', + 'version': 5, + 'stages': 2, + }, }, ), ( @@ -310,7 +324,11 @@ const List<({String haystack, JsonMap hit})> probeHits = [ JsonMap? probeReply(JsonMap request) { final id = request['id']; final type = '${request['type']}'; - JsonMap error(String message) => {'id': id, 'type': 'error', 'error': message}; + JsonMap error(String message) => { + 'id': id, + 'type': 'error', + 'error': message, + }; switch (type) { case 'subscribe': case 'unsubscribe': @@ -455,9 +473,26 @@ class _FixtureSink implements WebSocketSink { dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); } +/// Static-server capture flags, so a plain file server (no index.html +/// fallback for `/runs/7`) can still open a deep location: +/// +/// `?route=/runs/7/stage/build%3Fvisit%3D1` opens that app location; +/// `?q=release` types that query into Search once its field is shown. void main() { final params = Uri.base.queryParameters; final cupertino = params['platform'] == 'cupertino'; + final route = params['route']; + if (route != null && route.startsWith('/')) { + final platform = cupertino ? 'platform=cupertino' : ''; + final joiner = route.contains('?') ? '&' : '?'; + web.window.history.replaceState( + null, + '', + platform.isEmpty ? route : '$route$joiner$platform', + ); + } + final query = params['q']; + if (query != null && query.isNotEmpty) _typeSearchWhenShown(query); useAppUrlStrategy(); runApp( PipelinesApp( @@ -467,3 +502,34 @@ void main() { ), ); } + +/// Types [query] into Search's field once it is shown, through the field's +/// own change and submit callbacks, exactly as typing would. +void _typeSearchWhenShown(String query) { + void attempt(Duration _) { + AppSearchField? found; + void visit(Element element) { + if (found != null) return; + final widget = element.widget; + if (widget is AppSearchField && widget.fieldKey == searchFieldKey) { + found = widget; + return; + } + element.visitChildren(visit); + } + + WidgetsBinding.instance.rootElement?.visitChildren(visit); + final field = found; + if (field == null) { + WidgetsBinding.instance.addPostFrameCallback(attempt); + WidgetsBinding.instance.scheduleFrame(); + return; + } + field.controller.text = query; + field.onChanged?.call(query); + field.onSubmitted?.call(query); + } + + WidgetsFlutterBinding.ensureInitialized(); + WidgetsBinding.instance.addPostFrameCallback(attempt); +}