Merge commit '66a96ad136930286c817a282bc253dd7f7c9980a' into pipelines/run-20261112-0053-clear-empty-states-on-a-new-server-e7cd
This commit is contained in:
@@ -147,11 +147,14 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
|
||||
/// focus. Over a single pane it swaps in the chat shown before this one
|
||||
/// instead, and back again (see [_toggleRecentChat]). Command+Tab stays
|
||||
/// with the operating system's application switcher. While the app's
|
||||
/// terminal is shown, Ctrl+Tab moves between its tabs instead.
|
||||
/// terminal is shown, Ctrl+Tab moves between its tabs instead. While a
|
||||
/// floating chat window holds the keyboard, Ctrl+Tab cycles those windows
|
||||
/// (see [ChatWindows]).
|
||||
bool _cycleChatKey(KeyEvent event) {
|
||||
final keyboard = HardwareKeyboard.instance;
|
||||
if (event is! KeyDownEvent ||
|
||||
TerminalScope.peek(context)?.claimsTabKeys == true ||
|
||||
keyboardWindow()?.entry.kind == chatWindowKind ||
|
||||
event.logicalKey != LogicalKeyboardKey.tab ||
|
||||
!keyboard.isControlPressed ||
|
||||
keyboard.isMetaPressed ||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'chat_pane_content.dart';
|
||||
import 'chat_runtime.dart';
|
||||
import 'windows/chat_window_tabs.dart';
|
||||
import 'windows/chat_windows.dart';
|
||||
import 'workspace/federated_workspace_store.dart';
|
||||
import '../../core/servers/chat/federated_chat_gateway.dart';
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../shell/windows/window_entry.dart';
|
||||
import '../../../shell/windows/window_scope.dart';
|
||||
|
||||
/// The step Ctrl+Tab (1) or Ctrl+Shift+Tab (-1) moves between floating chat
|
||||
/// windows, or null for any other key. Command+Tab stays with the system.
|
||||
int? chatWindowTabStep(KeyEvent event, HardwareKeyboard keyboard) {
|
||||
if (event is! KeyDownEvent ||
|
||||
event.logicalKey != LogicalKeyboardKey.tab ||
|
||||
!keyboard.isControlPressed ||
|
||||
keyboard.isMetaPressed ||
|
||||
keyboard.isAltPressed) {
|
||||
return null;
|
||||
}
|
||||
return keyboard.isShiftPressed ? -1 : 1;
|
||||
}
|
||||
|
||||
/// The window [step] away from the window [currentId] in [visible] (bottom
|
||||
/// to top), wrapping around. Null when [currentId] is not listed or there is
|
||||
/// no other window to move to.
|
||||
WindowEntry? chatWindowAfter(
|
||||
List<WindowEntry> visible,
|
||||
String currentId,
|
||||
int step,
|
||||
) {
|
||||
final at = visible.indexWhere((w) => w.id == currentId);
|
||||
if (at < 0 || visible.length < 2) return null;
|
||||
return visible[(at + step) % visible.length];
|
||||
}
|
||||
|
||||
/// The floating window whose content holds the keyboard, if one does. Read
|
||||
/// from the focused node's ancestors, so it needs no reference to the host.
|
||||
WindowScope? keyboardWindow() {
|
||||
final context = FocusManager.instance.primaryFocus?.context;
|
||||
if (context == null) return null;
|
||||
return context.findAncestorWidgetOfExactType<WindowScope>();
|
||||
}
|
||||
@@ -8,11 +8,13 @@ import '../../../shell/list_detail_policy.dart';
|
||||
import '../../../shell/windows/window_entry.dart';
|
||||
import '../../../shell/windows/window_kind.dart';
|
||||
import '../../../shell/windows/window_manager.dart';
|
||||
import '../../terminal/terminal_scope.dart';
|
||||
import '../chat_runtime.dart';
|
||||
import '../domain/chat_commands.dart';
|
||||
import '../workspace/chat_float_shortcut.dart';
|
||||
import '../workspace/chat_float_store.dart';
|
||||
import 'chat_window_content.dart';
|
||||
import 'chat_window_tabs.dart';
|
||||
|
||||
const chatWindowKind = 'chat';
|
||||
|
||||
@@ -79,7 +81,9 @@ class ChatWindows {
|
||||
if (_started) return;
|
||||
_started = true;
|
||||
manager.kinds.register(kind);
|
||||
FocusManager.instance.addEarlyKeyEventHandler(_key);
|
||||
FocusManager.instance
|
||||
..addEarlyKeyEventHandler(_key)
|
||||
..addEarlyKeyEventHandler(_tabKey);
|
||||
runtime.addSessionReplacedListener(_replacedElsewhere);
|
||||
runtime.sessions.addListener(_rowsChanged);
|
||||
manager.addListener(_rowsChanged);
|
||||
@@ -89,7 +93,9 @@ class ChatWindows {
|
||||
void dispose() {
|
||||
if (!_started) return;
|
||||
_started = false;
|
||||
FocusManager.instance.removeEarlyKeyEventHandler(_key);
|
||||
FocusManager.instance
|
||||
..removeEarlyKeyEventHandler(_key)
|
||||
..removeEarlyKeyEventHandler(_tabKey);
|
||||
runtime.removeSessionReplacedListener(_replacedElsewhere);
|
||||
runtime.sessions.removeListener(_rowsChanged);
|
||||
manager.removeListener(_rowsChanged);
|
||||
@@ -224,6 +230,36 @@ class ChatWindows {
|
||||
if (event is KeyDownEvent) manager.toggleOrRaiseGroup(chatWindowKind);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
/// Ctrl+Tab and Ctrl+Shift+Tab while a floating chat window holds the
|
||||
/// keyboard: the next (previous) visible chat window, in stacking order and
|
||||
/// wrapping, comes to the top. The window host then gives it the keyboard,
|
||||
/// its composer. Left alone when another window or the tiling has the
|
||||
/// keyboard, when the terminal claims tab keys, or with one window.
|
||||
KeyEventResult _tabKey(KeyEvent event) {
|
||||
final step = chatWindowTabStep(event, HardwareKeyboard.instance);
|
||||
if (step == null || !_wide) return KeyEventResult.ignored;
|
||||
final scope = keyboardWindow();
|
||||
if (scope == null ||
|
||||
scope.entry.kind != chatWindowKind ||
|
||||
_terminalClaimsTabs()) {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
final target = chatWindowAfter(
|
||||
windows.where(manager.isVisible).toList(),
|
||||
scope.entry.id,
|
||||
step,
|
||||
);
|
||||
if (target == null) return KeyEventResult.ignored;
|
||||
manager.raise(target.id);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
bool _terminalClaimsTabs() {
|
||||
final context = FocusManager.instance.primaryFocus?.context;
|
||||
return context != null &&
|
||||
TerminalScope.peek(context)?.claimsTabKeys == true;
|
||||
}
|
||||
}
|
||||
|
||||
class _Never implements Listenable {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'chat_center_stage_layout.dart';
|
||||
|
||||
/// Hairline thickness of a center-stage edge.
|
||||
const double chatCenterStageEdgeThickness = 1;
|
||||
|
||||
/// Where the stage's two hairlines sit: each in the gap beside the stage, or on
|
||||
/// the workspace edge when the stage reaches it. Returns (left, right).
|
||||
(Rect, Rect) chatCenterStageEdgeRects(Rect stage, Size size) {
|
||||
final half = chatCenterStageGap / 2;
|
||||
const t = chatCenterStageEdgeThickness;
|
||||
final maxX = size.width - t;
|
||||
final leftX = stage.left <= 0
|
||||
? 0.0
|
||||
: (stage.left - half - t / 2).clamp(0.0, maxX).toDouble();
|
||||
final rightX = stage.right >= size.width
|
||||
? maxX
|
||||
: (stage.right + half - t / 2).clamp(0.0, maxX).toDouble();
|
||||
return (
|
||||
Rect.fromLTWH(leftX, 0, t, size.height),
|
||||
Rect.fromLTWH(rightX, 0, t, size.height),
|
||||
);
|
||||
}
|
||||
|
||||
/// The stage's left and right hairlines in the workspace's stack, drawn in the
|
||||
/// theme's outlineVariant so the centred chat column has a visible boundary.
|
||||
/// Only center stage calls this; the split layout keeps its own dividers.
|
||||
List<Widget> chatCenterStageEdges({
|
||||
required BuildContext context,
|
||||
required Rect rect,
|
||||
required Size size,
|
||||
}) {
|
||||
final color = Theme.of(context).colorScheme.outlineVariant;
|
||||
final (left, right) = chatCenterStageEdgeRects(rect, size);
|
||||
return [
|
||||
Positioned.fromRect(
|
||||
key: const ValueKey('chat-center-stage-edge-left'),
|
||||
rect: left,
|
||||
child: ColoredBox(color: color),
|
||||
),
|
||||
Positioned.fromRect(
|
||||
key: const ValueKey('chat-center-stage-edge-right'),
|
||||
rect: right,
|
||||
child: ColoredBox(color: color),
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'chat_center_stage_edges.dart';
|
||||
import 'chat_center_stage_motion.dart';
|
||||
import 'chat_center_stage_strip.dart';
|
||||
import 'chat_mobile_panes.dart';
|
||||
@@ -138,6 +139,12 @@ Widget chatWorkspaceSurface({
|
||||
for (final pane in livePanes)
|
||||
if (pane.key == ValueKey('chat-workspace-${motion.topPaneId}'))
|
||||
pane,
|
||||
if (stage.stage case final layout?)
|
||||
...chatCenterStageEdges(
|
||||
context: context,
|
||||
rect: stage.rectFor(layout.stageId)!,
|
||||
size: size,
|
||||
),
|
||||
if (mobile?.peekId != null && !motion.isAnimating)
|
||||
Positioned(
|
||||
top: mobile!.contentHeight - 12,
|
||||
|
||||
@@ -4,6 +4,7 @@ import '../chat/workspace/chat_center_stage_controller.dart';
|
||||
import '../chat/workspace/chat_float_shortcut.dart';
|
||||
import '../terminal/terminal_shortcuts.dart';
|
||||
import '../../shell/windows/window_shortcuts.dart';
|
||||
import '../../shell/shell_chat_shortcut.dart';
|
||||
import '../../shell/shell_search_shortcut_labels.dart';
|
||||
|
||||
/// A shortcut entry shown in the in-app help. Keeping these entries together
|
||||
@@ -53,6 +54,13 @@ class KeyboardShortcutRegistry {
|
||||
caveat:
|
||||
'Brings a chat forward from Terminal and focuses its message input.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Open Chat',
|
||||
keys: shellChatShortcutLabels(platform).join(', '),
|
||||
caveat: web
|
||||
? 'Shows the open chat and focuses its message input. The browser may reserve Ctrl+K.'
|
||||
: 'Shows the open chat and focuses its message input. In the terminal Ctrl+K stays kill-line; Alt+K still opens Chat.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Toggle Center Stage',
|
||||
keys:
|
||||
|
||||
@@ -9,7 +9,6 @@ abstract final class SettingsKeys {
|
||||
static const reconnect = ValueKey<String>('settings.reconnect');
|
||||
static const workspace = ValueKey<String>('settings.workspace');
|
||||
static const saveWorkspace = ValueKey<String>('settings.saveWorkspace');
|
||||
static const templates = ValueKey<String>('settings.templates');
|
||||
static const schedules = ValueKey<String>('settings.schedules');
|
||||
static const keyboardShortcuts = ValueKey<String>(
|
||||
'settings.keyboardShortcuts',
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'settings_row.dart';
|
||||
/// The Settings entry to the saved-schedule list.
|
||||
///
|
||||
/// The row only opens the route; the list's own controller performs the single
|
||||
/// `list_schedules` read, exactly like the Templates entry.
|
||||
/// `list_schedules` read.
|
||||
const String settingsSchedulesLabel = 'Browse schedules';
|
||||
const String settingsSchedulesSecondary =
|
||||
'Saved run configurations for every pipeline.';
|
||||
|
||||
@@ -33,7 +33,6 @@ import 'security/settings_security_section.dart';
|
||||
import 'settings_updates_section.dart';
|
||||
import '../updates/app_updates.dart';
|
||||
import 'settings_store.dart';
|
||||
import 'settings_templates_section.dart';
|
||||
import 'server_connections.dart';
|
||||
import 'saved_servers_section.dart';
|
||||
import 'managed_connection_section.dart';
|
||||
@@ -58,7 +57,6 @@ class SettingsScreen extends StatefulWidget {
|
||||
this.ping,
|
||||
this.embedded = false,
|
||||
this.navigationScope,
|
||||
this.onOpenTemplates,
|
||||
this.onOpenSchedules,
|
||||
this.notifications,
|
||||
this.showSignIn = false,
|
||||
@@ -108,10 +106,6 @@ class SettingsScreen extends StatefulWidget {
|
||||
/// The logical server scope used to restore the last Settings category.
|
||||
final String? navigationScope;
|
||||
|
||||
/// Opens the Templates gallery. Null keeps Settings standalone/incomplete
|
||||
/// without a dead row that would go nowhere.
|
||||
final VoidCallback? onOpenTemplates;
|
||||
|
||||
/// Opens the saved-schedule list above Settings.
|
||||
final VoidCallback? onOpenSchedules;
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'settings_keys.dart';
|
||||
import 'settings_row.dart';
|
||||
|
||||
/// The Settings entry to the Templates gallery.
|
||||
///
|
||||
/// The row wording matches the web Settings page: `Browse templates` with the
|
||||
/// server-catalogue secondary line. It only opens the route; loading the
|
||||
/// catalogue is the gallery's own read.
|
||||
const String settingsTemplatesLabel = 'Browse templates';
|
||||
const String settingsTemplatesSecondary =
|
||||
'Reusable pipeline definitions offered by the server.';
|
||||
|
||||
/// A navigation row (chevron) for a Settings group.
|
||||
class SettingsTemplatesSection extends StatelessWidget {
|
||||
const SettingsTemplatesSection({super.key, required this.onOpen});
|
||||
|
||||
final VoidCallback onOpen;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SettingsRow(
|
||||
key: SettingsKeys.templates,
|
||||
leading: const Icon(Icons.widgets_outlined),
|
||||
title: const Text(settingsTemplatesLabel),
|
||||
subtitle: const Text(settingsTemplatesSecondary),
|
||||
chevron: true,
|
||||
onTap: onOpen,
|
||||
);
|
||||
}
|
||||
@@ -87,16 +87,11 @@ extension _SettingsTopicPages on _SettingsScreenState {
|
||||
leadingRows: true,
|
||||
children: const [SettingsKeyboardShortcutsSection()],
|
||||
),
|
||||
if (widget.onOpenSchedules != null || widget.onOpenTemplates != null)
|
||||
if (widget.onOpenSchedules case final open?)
|
||||
SettingsGroup(
|
||||
title: 'Library',
|
||||
leadingRows: true,
|
||||
children: [
|
||||
if (widget.onOpenSchedules case final open?)
|
||||
SettingsSchedulesSection(onOpen: open),
|
||||
if (widget.onOpenTemplates case final open?)
|
||||
SettingsTemplatesSection(onOpen: open),
|
||||
],
|
||||
children: [SettingsSchedulesSection(onOpen: open)],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user