Fix shell rail surface and empty action island

Paint the navigation rail through its top inset and only add the floating-windows action when a listed window exists. Add focused widget coverage and document the reviewed UI states so the shell no longer shows a white strip or empty trailing pill.
This commit is contained in:
2026-11-12 10:37:56 +00:00
parent 24618964ce
commit e2e61ac005
7 changed files with 296 additions and 31 deletions
+3 -3
View File
@@ -41,7 +41,6 @@ import '../shell/windows/window_host.dart';
import '../shell/windows/window_kind.dart';
import '../shell/windows/window_manager.dart';
import '../shell/windows/window_store.dart';
import '../shell/windows/windows_menu_button.dart';
import 'app_terminals.dart';
import '../features/chat/chat_runtime.dart';
import '../features/chat/windows/chat_windows.dart';
@@ -841,9 +840,10 @@ class _PipelinesAppState extends State<PipelinesApp>
// The terminal button sits on the Chat tab's shell bar on wide layouts;
// a narrow layout has it in the chat's own bar instead. The keyboard
// shortcut still toggles the terminal everywhere.
// The Windows button (shown on every tab while the app has floating
// windows) is the shell's: it lists the manager's windows.
windowManager: _windows,
barActions: [
// Shown on every tab while the app has floating windows.
WindowsMenuButton(manager: _windows),
if (_destinationOf(route.kind) == AppDestination.chat)
?_terminals.barToggle(context),
],
+18 -1
View File
@@ -17,6 +17,8 @@ import 'shell_list_shortcuts.dart';
import 'shell_runs_pipelines_shortcut.dart';
import 'shell_search_shortcut_labels.dart';
import 'tab_history.dart';
import 'windows/window_manager.dart';
import 'windows/windows_menu_button.dart';
import '../ui/input/keyboard_owner.dart';
class AdaptiveShell extends StatefulWidget {
@@ -33,12 +35,18 @@ class AdaptiveShell extends StatefulWidget {
this.runningRunCount,
this.listPaneWidthStore = const SharedPreferencesListPaneWidthStore(),
this.barActions = const [],
this.windowManager,
});
/// Actions every destination's bar ends with (the Terminal toggle), after
/// the screen's own or Search.
final List<Widget> barActions;
/// The floating windows the bar's Windows button lists. The button is shown
/// only while one is open, so the bar draws no empty action island; null
/// (plain shells) shows none.
final WindowManager? windowManager;
/// Where each destination's dragged list-pane width is kept on this device.
final ListPaneWidthStore listPaneWidthStore;
@@ -241,7 +249,11 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
SegmentedBar currentBar() =>
_segmentedBar(_bar.specFor(_selected), details.label, page: page);
final topBar = _ListPaneBar(
listenable: Listenable.merge([_bar.bar, _paneWidths]),
listenable: Listenable.merge([
_bar.bar,
_paneWidths,
?widget.windowManager,
]),
initial: currentBar(),
split: () => _bar.split(_selected),
preferredWidth: () => _paneWidths.widthFor(_selected.name),
@@ -443,6 +455,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
final onBack = spec?.onBack ?? (page ? _closePage : null);
final published = spec?.actions ?? const <Widget>[];
final onSearch = widget.onSearch;
final windows = widget.windowManager;
return SegmentedBar(
automaticallyImplyLeading: false,
leading: onBack == null
@@ -477,6 +490,10 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
tooltip: 'Search (${shellSearchShortcutLabels().join(', ')})',
icon: const Icon(Icons.search),
),
// The Windows button leads the shell's own actions, only while a
// floating window is listed; an empty button would draw an empty island.
if (windows != null && WindowsMenuButton.hasWindows(windows))
WindowsMenuButton(manager: windows),
...widget.barActions,
],
);
+36 -27
View File
@@ -50,35 +50,44 @@ class ShellNavigationRail extends StatelessWidget {
@override
Widget build(BuildContext context) {
final index = shellTabDestinations.indexOf(selected);
return Padding(
padding: padding,
child: SizedBox(
width: kNavigationRailWidth,
child: NavigationRail(
key: const ValueKey('shell.navigation-rail'),
minWidth: kNavigationRailWidth,
labelType: NavigationRailLabelType.all,
selectedIndex: index < 0 ? null : index,
onDestinationSelected: (value) =>
onSelected(shellTabDestinations[value]),
destinations: [
for (final destination in shellTabDestinations)
NavigationRailDestination(
icon: KeyedSubtree(
key: ValueKey('shell.destination.${destination.name}'),
// The bar it replaces named each tab in a tooltip too.
child: Tooltip(
message: destinationDetails(destination).label,
child: icon(destination),
final surface = Theme.of(context).colorScheme.surface;
// The surface runs under the top inset too: the padding only moves the
// rail's content below the system's top, so no unpainted strip shows above
// the rail's background.
return ColoredBox(
key: const ValueKey('shell.navigation-rail.surface'),
color: surface,
child: Padding(
padding: padding,
child: SizedBox(
width: kNavigationRailWidth,
child: NavigationRail(
key: const ValueKey('shell.navigation-rail'),
backgroundColor: surface,
minWidth: kNavigationRailWidth,
labelType: NavigationRailLabelType.all,
selectedIndex: index < 0 ? null : index,
onDestinationSelected: (value) =>
onSelected(shellTabDestinations[value]),
destinations: [
for (final destination in shellTabDestinations)
NavigationRailDestination(
icon: KeyedSubtree(
key: ValueKey('shell.destination.${destination.name}'),
// The bar it replaces named each tab in a tooltip too.
child: Tooltip(
message: destinationDetails(destination).label,
child: icon(destination),
),
),
label: Text(destinationDetails(destination).label),
),
label: Text(destinationDetails(destination).label),
),
],
trailingAtBottom: true,
trailing: _SettingsRailItem(
selected: selected == AppDestination.settings,
onTap: () => onSelected(AppDestination.settings),
],
trailingAtBottom: true,
trailing: _SettingsRailItem(
selected: selected == AppDestination.settings,
onTap: () => onSelected(AppDestination.settings),
),
),
),
),
@@ -12,6 +12,11 @@ class WindowsMenuButton extends StatelessWidget {
final WindowManager manager;
/// Whether [manager] has a window to list: the shell bar keeps the button
/// out of its actions otherwise, so no empty action island is drawn.
static bool hasWindows(WindowManager manager) =>
manager.windows.any((w) => manager.kinds[w.kind] != null);
@override
Widget build(BuildContext context) => ListenableBuilder(
listenable: Listenable.merge([
+73
View File
@@ -0,0 +1,73 @@
# Rail top strip and empty top-right island
Two shell chrome defects on the wide layout (run 20261112-1022).
## Causes
- **White strip above the rail (96x8 at y=0).** On a wide window
`WindowMargins` adds `wideExtraTop` (16 - 8 = 8 px) to `MediaQuery` top
padding. `ShellNavigationRail` pads its rail by that top inset with a plain
`Padding`, so the 8 px above the rail's Material surface was never painted
and showed the canvas behind it (white in both themes).
- **Empty circular pill (top right of Search and Settings).**
`pipelines_app.dart` put `WindowsMenuButton` in `barActions` on every tab.
The button returns `SizedBox.shrink()` with no open window, but
`SegmentedBar` counted it as an action, so the trailing island was drawn
around nothing.
## Changes (app/)
- `lib/shell/navigation_rail.dart`: the rail is wrapped in a `ColoredBox`
(key `shell.navigation-rail.surface`) in the theme surface, and the
`NavigationRail` gets the same `backgroundColor`. The top inset still moves
the rail's content down; the inset itself is painted.
- `lib/shell/windows/windows_menu_button.dart`: new static
`WindowsMenuButton.hasWindows(manager)`, the single predicate for "a window
is listed".
- `lib/shell/adaptive_shell.dart`: new optional `windowManager` parameter.
The shell adds the Windows button to the bar's actions only when
`hasWindows` is true, and merges the manager into the top bar's listenable
so the island appears and disappears with windows.
- `lib/application/pipelines_app.dart`: the Windows button is no longer in
`barActions`; `windowManager: _windows` is passed to the shell instead.
## Tests (focused, run through tool/memwatch/full.sh)
Paths: `test/shell/navigation_rail_surface_test.dart`,
`test/shell/shell_bar_empty_actions_test.dart`,
`test/shell/navigation_rail_test.dart` (existing, affected by the rail
change), `test/shell/windows/window_conveniences_test.dart` (existing, uses
`WindowsMenuButton` directly).
- Result: `PASS: 28 passed, 0 failed, 0 skipped; peak 1128 MB; 4s; exit 0`.
- Rail surface, light and dark: the cover is at y=0, its colour equals the
theme surface, the rail's background equals it, the rail content starts at
the 8 px inset, and the strip above it is inside the cover.
- Action island: Search, Settings and Pipelines at 1000 px and 430 px draw no
`segmented.actions` island with no window; a shell with no window manager
draws none; the Windows button is the island only while a window is open
and goes away when it closes.
`tool/analyze.sh`: clean, exit 0.
Not run: the land gate and the full app suite (owned by the gate stage).
Pre-existing failures listed in the memory note were not checked here.
## Affected UI states (for ui-review to capture)
- Wide window (1600x1000), light and dark: rail top (should now be the
surface colour, not white), on every tab and on Settings.
- Wide and narrow (430x900), Search and Settings: no empty pill at top right.
- Wide window with one or more floating windows open: the Windows button is
shown in the top-right island.
Before-captures exist in `/tmp/ui-review/` (`base-dark-1600x1000/12-settings.png`,
`base-light-430x900/11-search.png`, and others). No after-captures were
taken in this stage, per the stage rules; ui-review owns capture.
## Limitations
- The "rail top colour equals rail surface" check is a widget-tree check
(colour and rect), not a pixel read from a rendered frame.
- `WindowMargins` (the source of the 8 px) is untouched; the fix is at the
rail, so the rail's content position is unchanged.
@@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/shell/navigation_rail.dart';
/// The rail's surface runs from the window's top edge. The system's top inset
/// is kept clear for the rail's content, but it is painted with the rail's
/// surface, so no unpainted strip (white in the app's canvas) shows above it.
void main() {
for (final brightness in Brightness.values) {
testWidgets('the rail top under a system inset is the rail surface '
'(${brightness.name})', (tester) async {
tester.view.physicalSize = const Size(1000, 800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final theme = ThemeData(
colorSchemeSeed: Colors.purple,
brightness: brightness,
);
await tester.pumpWidget(
MaterialApp(
theme: theme,
home: Scaffold(
body: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ShellNavigationRail(
selected: AppDestination.pipelines,
icon: (destination) =>
Icon(destinationDetails(destination).icon),
onSelected: (_) {},
padding: const EdgeInsets.only(top: 8),
),
],
),
),
),
);
await tester.pumpAndSettle();
final surface = theme.colorScheme.surface;
final cover = find.byKey(const ValueKey('shell.navigation-rail.surface'));
final rail = find.byKey(const ValueKey('shell.navigation-rail'));
// The cover and the rail's own background are the same surface colour.
expect(tester.widget<ColoredBox>(cover).color, surface);
expect(tester.widget<NavigationRail>(rail).backgroundColor, surface);
// The rail's content starts below the inset, and the cover starts at the
// window's top edge, so the inset strip is covered.
final coverRect = tester.getRect(cover);
final railRect = tester.getRect(rail);
expect(coverRect.top, 0);
expect(railRect.top, 8);
expect(
coverRect.contains(Offset(railRect.center.dx, 2)),
isTrue,
reason: 'the strip above the rail content is painted',
);
});
}
}
@@ -0,0 +1,98 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/shell/windows/window_manager.dart';
import 'windows/window_test_harness.dart';
/// The shell bar's trailing action island is drawn only with actions. The
/// Windows button is one of them only while a floating window is open, so
/// Search and Settings (and every other route) show no empty pill at any size.
void main() {
Future<void> pumpShell(
WidgetTester tester, {
required AppDestination destination,
required double width,
WindowManager? windowManager,
}) async {
tester.view.physicalSize = Size(width, 800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(
MaterialApp(
home: AdaptiveShell(
destination: destination,
windowManager: windowManager,
destinationBodies: {
for (final value in AppDestination.values)
value: (_) => Text('${value.name} body'),
},
),
),
);
await tester.pumpAndSettle();
}
final actionIsland = find.byKey(const ValueKey('segmented.actions'));
for (final width in [1000.0, 430.0]) {
for (final destination in [
AppDestination.search,
AppDestination.settings,
AppDestination.pipelines,
]) {
testWidgets(
'${destination.name} at width ${width.toInt()} draws no empty action '
'island with no floating window',
(tester) async {
await pumpShell(
tester,
destination: destination,
width: width,
windowManager: probeManager(),
);
expect(actionIsland, findsNothing);
expect(find.byKey(const ValueKey('shell.windows')), findsNothing);
},
);
}
}
testWidgets('a shell without a window manager draws no action island', (
tester,
) async {
await pumpShell(tester, destination: AppDestination.settings, width: 1000);
expect(actionIsland, findsNothing);
});
testWidgets('the Windows button is the island only while a window is open', (
tester,
) async {
final manager = probeManager();
await pumpShell(
tester,
destination: AppDestination.search,
width: 1000,
windowManager: manager,
);
expect(actionIsland, findsNothing);
final entry = manager.open('probe', 'a');
await tester.pumpAndSettle();
expect(actionIsland, findsOneWidget);
expect(
find.descendant(
of: actionIsland,
matching: find.byKey(const ValueKey('shell.windows')),
),
findsOneWidget,
);
manager.close(entry.id);
await tester.pumpAndSettle();
expect(actionIsland, findsNothing);
expect(find.byKey(const ValueKey('shell.windows')), findsNothing);
});
}