Always show the terminal shortcut on the phone Chat page

The shortcut no longer waits for a running shell: on the Chat page it opens
the terminal, starting one at its login prompt when none is open, and shows
a count when more than one shell runs.
This commit is contained in:
2026-11-10 02:25:36 +00:00
parent d52eb4ba82
commit 87519985bf
3 changed files with 16 additions and 13 deletions
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
import '../../ui/adaptive/segmented_bar_pieces.dart';
/// On a phone, a small floating button below the top bar's right end that
/// reopens the full-screen terminal while a shell is running there. It shows
/// how many shells are running when there is more than one.
/// opens the full-screen terminal. It shows how many shells are running when
/// there is more than one.
class TerminalShortcutBubble extends StatelessWidget {
const TerminalShortcutBubble({
super.key,
@@ -28,9 +28,9 @@ class TerminalShortcutBubble extends StatelessWidget {
@override
Widget build(BuildContext context) {
final label = running == 1
? 'Open terminal'
: 'Open terminal, $running running';
final label = running > 1
? 'Open terminal, $running running'
: 'Open terminal';
final icon = Icon(
cupertino
? CupertinoIcons.chevron_left_slash_chevron_right
@@ -187,12 +187,13 @@ class _TerminalSurfaceState extends State<TerminalSurface>
if (mounted) setState(() {});
}
/// Running shells on a phone with the terminal page closed get a small
/// shortcut below the top bar's right end. The stack is always there so the
/// On a phone, the Chat page offers a small shortcut below the top bar's
/// right end that opens the terminal (starting one at its login prompt when
/// none is open). The stack is always there so the
/// app below never remounts when the shortcut comes or goes.
Widget _withShortcut(Widget child) {
final running = widget.hub.tabs.where((tab) => tab.info.running).length;
final show = widget.shortcutHere && _narrow && running > 0 && !_page.open;
final show = widget.shortcutHere && _narrow && !_page.open;
return Stack(
fit: StackFit.passthrough,
children: [
@@ -297,15 +297,17 @@ void main() {
) async {
await pumpApp(tester, size: const Size(390, 800), onChat: false);
final bubble = find.byKey(const Key('terminal-shortcut-bubble'));
await tester.tap(find.byTooltip(TerminalToggleButton.label));
await tester.pumpAndSettle();
await tester.pageBack();
await tester.pumpAndSettle();
expect(hub.tabs, isNotEmpty);
expect(bubble, findsNothing, reason: 'not on Pipelines, Runs or Search');
await pumpApp(tester, size: const Size(390, 800));
await tester.pumpAndSettle();
// Shown on Chat even before any shell runs; tapping opens the terminal.
expect(hub.tabs, isEmpty);
expect(bubble, findsOneWidget, reason: 'shown on Chat');
expect(find.bySemanticsLabel('Open terminal'), findsOneWidget);
await tester.tap(bubble);
await tester.pumpAndSettle();
expect(find.widgetWithText(AppBar, 'Terminal'), findsOneWidget);
expect(bubble, findsNothing, reason: 'hidden while the page is open');
});
}