Show a terminal shortcut below the top bar on phones

While shells are running and the full-screen terminal is closed, a small
floating button under the right end of the top bar reopens it, with a count
when more than one shell runs. The surface's stack is always present so the
app never remounts when the shortcut comes or goes.
This commit is contained in:
2026-11-10 00:23:53 +00:00
parent b44938d028
commit 070f9e205e
3 changed files with 131 additions and 3 deletions
@@ -258,6 +258,37 @@ void main() {
expect(hub.tabs, hasLength(2));
},
);
desktopTestWidgets(
'a phone with running shells shows a shortcut below the top bar that '
'reopens the terminal',
(tester) async {
await pumpApp(tester, size: const Size(390, 800));
final bubble = find.byKey(const Key('terminal-shortcut-bubble'));
// The shells load when the terminal is first shown.
await tester.tap(find.byTooltip(TerminalToggleButton.label));
await tester.pumpAndSettle();
expect(bubble, findsNothing, reason: 'hidden while the page is open');
await tester.pageBack();
await tester.pumpAndSettle();
expect(bubble, findsOneWidget);
expect(find.bySemanticsLabel('Open terminal, 2 running'), findsOneWidget);
final rect = tester.getRect(bubble);
expect(rect.right, greaterThan(390 - 80), reason: 'on the right');
expect(rect.top, greaterThan(40), reason: 'below the top bar');
expect(rect.top, lessThan(160));
await tester.tap(bubble);
await tester.pumpAndSettle();
expect(find.widgetWithText(AppBar, 'Terminal'), findsOneWidget);
expect(bubble, findsNothing);
// Wide windows use the panel instead, so no shortcut there.
await tester.pageBack();
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(1200, 800);
await tester.pumpAndSettle();
expect(bubble, findsNothing);
},
);
}
/// Hardware keys reach the terminal on desktop; phones type through the