Expose pane actions in chat list menu
Share the open chat pane menu choices with session rows so list actions use the same handlers and target the selected chat. Add command routing, pane movement support, and focused coverage for wide and narrow layouts.
This commit is contained in:
@@ -20,6 +20,12 @@ import 'package:flutter/services.dart';
|
||||
|
||||
import '../../core/api_gateway.dart';
|
||||
import '../../core/servers/server_scope.dart';
|
||||
import '../../shell/windows/window_scope.dart';
|
||||
import 'shell/chat_shell_command.dart';
|
||||
import 'shell/chat_shell_dismiss.dart';
|
||||
import '../terminal/terminal_open_action.dart';
|
||||
import 'ui/sessions/session_pane_menu.dart';
|
||||
import 'workspace/chat_pane_commands.dart';
|
||||
import 'workspace/chat_float_shortcut.dart';
|
||||
import 'workspace/chat_workspace_binding.dart';
|
||||
import 'workspace/chat_workspace_snapshot.dart';
|
||||
@@ -34,6 +40,7 @@ import 'workspace/chat_center_stage_action.dart';
|
||||
import 'workspace/chat_center_stage_controller.dart';
|
||||
import 'workspace/chat_center_stage_keys.dart';
|
||||
import 'workspace/chat_pane_move_actions.dart';
|
||||
import 'workspace/chat_pane_move_shortcuts.dart';
|
||||
import 'workspace/chat_workspace_entrance.dart';
|
||||
import 'ui/sessions/chat_adaptive.dart';
|
||||
import 'conversation/composer_focus_request.dart';
|
||||
@@ -49,6 +56,7 @@ import 'ui/sessions/chat_sessions_screen.dart';
|
||||
import '../../ui/input/keyboard_owner.dart';
|
||||
|
||||
part 'chat_screen_float.dart';
|
||||
part 'chat_screen_pane_menu.dart';
|
||||
part 'chat_screen_keys.dart';
|
||||
part 'chat_screen_workspace.dart';
|
||||
|
||||
@@ -103,7 +111,11 @@ class ChatScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ChatScreenState extends State<ChatScreen>
|
||||
with _ChatScreenWorkspace, _ChatScreenKeys, _ChatScreenFloat {
|
||||
with
|
||||
_ChatScreenWorkspace,
|
||||
_ChatScreenKeys,
|
||||
_ChatScreenFloat,
|
||||
_ChatScreenPaneMenu {
|
||||
/// The chats' shared state: the list, opened rows, accepted models,
|
||||
/// transcript positions and caches (see [ChatRuntime]).
|
||||
late final ChatRuntime _runtime =
|
||||
@@ -221,6 +233,7 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
/// Opens [session] chosen by a tap, click or Next chat: its composer takes
|
||||
/// focus on a desktop host or after a mouse click, not from a finger on a
|
||||
/// phone or tablet (see [chatSelectionFocusesComposer]).
|
||||
@override
|
||||
void _openBySelection(JsonMap session) =>
|
||||
_open(session, focusComposer: chatSelectionFocusesComposer(session));
|
||||
|
||||
@@ -368,6 +381,7 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_paneCommands.dispose();
|
||||
HardwareKeyboard.instance.removeHandler(_cycleChatKey);
|
||||
HardwareKeyboard.instance.removeHandler(_slashFocusKey);
|
||||
_page.dispose();
|
||||
@@ -384,6 +398,10 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// Requests the chat list hands to an open chat (see [_ChatScreenPaneMenu]).
|
||||
@override
|
||||
final _paneCommands = ChatPaneCommands();
|
||||
|
||||
@override
|
||||
Widget _thread(ChatWorkspacePane pane) {
|
||||
final selected = pane.sessionId;
|
||||
@@ -401,6 +419,7 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
useNativeBack: _page.open,
|
||||
pasteTarget: _workspaceVisible && pane.id == _workspace.activePaneId,
|
||||
showBackButton: _page.open || !showsListBesideDetail(context),
|
||||
paneCommands: _paneCommands,
|
||||
paneControls: (paneContext) => [
|
||||
ChatBarAction(
|
||||
label: 'Add chat pane',
|
||||
@@ -467,6 +486,7 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
onOpenBeside: beside ? _openBeside : null,
|
||||
onOpenBelow: _openBelow,
|
||||
onFloat: _floatsHere ? _floatSession : null,
|
||||
paneMenu: this,
|
||||
onShortcutOpen: _openByShortcut,
|
||||
onSessions: _adoptRows,
|
||||
activeSessionId: selected,
|
||||
|
||||
Reference in New Issue
Block a user