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.
This commit is contained in:
2026-11-02 16:14:50 +00:00
parent 1f214d36bf
commit 885234e0e4
3 changed files with 36 additions and 2 deletions
+7 -1
View File
@@ -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]),