From 885234e0e4729a6f69cc1f88c53d1330d55301a3 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 2 Nov 2026 16:14:50 +0000 Subject: [PATCH] Cap the list pane at 440 px beside an open item On very wide windows (a 4K monitor) the list took 40% of the window; past 440 px the extra width now goes to the open item. Fold and laptop widths keep the 60/40 split. --- app/lib/shell/list_detail.dart | 8 +++++++- .../list_detail_consistency_test.dart | 11 ++++++++++- app/test/shell/list_pane_width_test.dart | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 app/test/shell/list_pane_width_test.dart diff --git a/app/lib/shell/list_detail.dart b/app/lib/shell/list_detail.dart index b3ab2f80..ae84895c 100644 --- a/app/lib/shell/list_detail.dart +++ b/app/lib/shell/list_detail.dart @@ -15,6 +15,10 @@ const double _bodyWindowTarget = 0.6; const double _bodyWindowMinimum = 0.5; const double _bodyAvailableMaximum = 0.75; +/// The widest the list pane grows beside an open item: on a very wide window +/// (a 4K monitor) the extra width goes to the open item, not the list. +const double kListPaneMaxWidth = 440; + /// Whether the window at [context] shows list and detail side by side. bool showsListBesideDetail(BuildContext context) => MediaQuery.sizeOf(context).width >= kListDetailMinWidth; @@ -29,7 +33,9 @@ double listDetailBodyWidth(double window, double available) { ? requestedMinimum : available * _bodyWindowMinimum; final maximum = math.max(minimum, available * _bodyAvailableMaximum); - return (window * _bodyWindowTarget).clamp(minimum, maximum); + final body = (window * _bodyWindowTarget).clamp(minimum, maximum); + // Past the list's cap, the open item takes the rest. + return math.max(body, available - 1 - kListPaneMaxWidth); } /// The list pane's width beside an open item (see [listDetailBodyWidth]), diff --git a/app/test/application/list_detail_consistency_test.dart b/app/test/application/list_detail_consistency_test.dart index 819e63ee..701acf38 100644 --- a/app/test/application/list_detail_consistency_test.dart +++ b/app/test/application/list_detail_consistency_test.dart @@ -1,8 +1,11 @@ +import 'dart:math' as math; + import 'dart:ui' show Tristate; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/shell/list_detail.dart'; import 'package:pipelines_app/ui/layout/app_list_row.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:pipelines_app/features/chat/screen.dart'; @@ -131,7 +134,13 @@ void main() { paneWidths.add(before); bodyWidths.add(bodyBefore); expect(bodyBefore, greaterThanOrEqualTo(width * 0.5)); - expect(bodyBefore, lessThanOrEqualTo(width * 0.6)); + // 60% of the window, or more once the list reaches its cap. + expect( + bodyBefore, + lessThanOrEqualTo( + math.max(width * 0.6, width - 1 - kListPaneMaxWidth) + 0.5, + ), + ); expect(bodyBefore, greaterThan(before)); final rowKeys = switch (destination) { 'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'], diff --git a/app/test/shell/list_pane_width_test.dart b/app/test/shell/list_pane_width_test.dart new file mode 100644 index 00000000..36b37b13 --- /dev/null +++ b/app/test/shell/list_pane_width_test.dart @@ -0,0 +1,19 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/shell/list_detail.dart'; + +void main() { + test('the list pane stops growing at its cap on very wide windows', () { + for (final width in [1920.0, 2560.0, 3840.0]) { + expect(listDetailListWidth(width, width), kListPaneMaxWidth); + expect(listDetailBodyWidth(width, width), width - 1 - kListPaneMaxWidth); + } + }); + + test('narrower windows keep the 60/40 split', () { + // An open Fold and a laptop window: the list is under its cap. + for (final width in [880.0, 1100.0]) { + expect(listDetailBodyWidth(width, width), closeTo(width * 0.6, 0.01)); + expect(listDetailListWidth(width, width), lessThan(kListPaneMaxWidth)); + } + }); +}