Route rail re-taps through destination reselection
Ensure the navigation rail shares the destination re-selection hook used by the phone tab bar, so re-tapping Chat can reopen active chats on wide layouts. Add focused coverage and record the land-gate verification results.
This commit is contained in:
@@ -288,7 +288,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
destination,
|
||||
destinationDetails(destination).icon,
|
||||
),
|
||||
onSelected: _select,
|
||||
// Every tab control shares the tap entry, so a rail
|
||||
// re-tap reaches the re-select hook like the bar's.
|
||||
onSelected: _tapDestination,
|
||||
padding: EdgeInsets.only(
|
||||
top: system.top,
|
||||
bottom: system.bottom,
|
||||
|
||||
@@ -56,3 +56,30 @@
|
||||
-> 10 passed, 0 failed (verdict named only these two paths).
|
||||
- `tool/analyze.sh` -> clean.
|
||||
- Not run: the other nine files from the earlier run; not rerun this visit.
|
||||
|
||||
## Land-gate fix: rail re-tap reaches the re-select hook
|
||||
- Cause: on a wide window (`showsNavigationRail`, width >=
|
||||
`kNavigationRailMinWindowWidth`) the rail's `onSelected` was wired to `_select`,
|
||||
so a re-tap of the shown Chat rail item never called `onDestinationReselected`.
|
||||
The floating bar already used `_tapDestination`.
|
||||
- Fix: `lib/shell/adaptive_shell.dart` passes `_tapDestination` to
|
||||
`ShellNavigationRail`. Settings on the rail goes through the same entry; it has
|
||||
no hook branch of its own, and `_reselectDestination` sends non-Chat tabs to
|
||||
`_selectDestination`, so Settings behaves as before.
|
||||
- Test: `test/shell/destination_reselect_test.dart` gains a phone-width case
|
||||
(400x800, floating bar) so both nav widgets are covered. The existing 800px cases
|
||||
exercise the rail.
|
||||
|
||||
## Focused results (app/, memwatch, this visit)
|
||||
- `test/shell/destination_reselect_test.dart test/application/chat_registration_test.dart`
|
||||
-> 11 passed, 0 failed (verdict named only these two paths).
|
||||
- Affected users of `AdaptiveShell` / the rail, run as one list of 17 files
|
||||
(rail, floating bar, tab history, shortcuts, menu, pipelines_app_test, chat
|
||||
wide/scroll back, chat open shortcut, chat control tab, terminal chat tab,
|
||||
chat next chat, plus the two above) -> 69 passed, 0 failed.
|
||||
- `test/application/tab_location_navigation_test.dart` -> 2 passed, 4 failed
|
||||
("Settings is retained...", "a delayed read merges...", "an explicit root URL...",
|
||||
"Settings does not clear..."). The same 4 fail with the rail line reverted to
|
||||
`_select`, and on untouched main (9999e091, temporary detached worktree, since
|
||||
removed). Pre-existing; not caused by this change, not fixed here.
|
||||
- `tool/analyze.sh` -> clean.
|
||||
|
||||
@@ -33,6 +33,34 @@ void main() {
|
||||
expect(selected, isEmpty);
|
||||
});
|
||||
|
||||
testWidgets('a phone tab bar re-tap of the shown tab re-selects it', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(400, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final selected = <AppDestination>[];
|
||||
final reselected = <AppDestination>[];
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: AdaptiveShell(
|
||||
destinationBodies: bodies(),
|
||||
destination: AppDestination.chat,
|
||||
onDestinationSelected: selected.add,
|
||||
onDestinationReselected: reselected.add,
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
|
||||
await tester.pump();
|
||||
|
||||
expect(reselected, [AppDestination.chat]);
|
||||
expect(selected, isEmpty);
|
||||
});
|
||||
|
||||
testWidgets('tapping another tab selects it, not a re-select', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user