Put the active chat on center stage with Ctrl/Cmd+E

This commit is contained in:
2026-11-10 12:57:39 +00:00
parent 19aa726e7f
commit e033d4e176
10 changed files with 653 additions and 83 deletions
@@ -292,83 +292,98 @@ mixin _ChatScreenWorkspace on State<ChatScreen> {
Widget _workspaceView() => SafeArea(
top: false,
child: ChatWorkspace(
key: _workspaceKey,
controller: _workspace,
onVisibleSessionIdsChanged: _workspaceVisibilityChanged,
shortcutsEnabled: _workspaceVisible,
singlePane: !showsListBesideDetail(context),
mobilePeeks: true,
paneTitle: (pane) =>
'${_rowFor(pane.sessionId)?['title'] ?? pane.sessionId}',
onFocusPane: (pane) => _composerFocus.request(pane.sessionId),
paneBuilder: (context, pane, active) {
final scope = ChatWorkspacePaneScope.maybeOf(context);
final topShared = scope?.topEdgeShared ?? false;
final bottomShared = scope?.bottomEdgeShared ?? false;
final leftShared = scope?.leftEdgeShared ?? false;
final rightShared = scope?.rightEdgeShared ?? false;
final activeColor = _workspace.paneCount > 1 && active
? chatColorShade(
context,
chatSessionColor(_rowFor(pane.sessionId)),
) ??
(chatControlsStyleOf(context) == ChatControlsStyle.cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary)
: Colors.transparent;
return Semantics(
selected: active,
child: AnimatedContainer(
duration: showsListBesideDetail(context)
? Motion.of(context, Motion.standard)
: Duration.zero,
curve: Motion.curve,
foregroundDecoration: BoxDecoration(
border: showsListBesideDetail(context)
? Border(
top: bottomShared && !topShared
? BorderSide(color: activeColor)
: BorderSide.none,
bottom: BorderSide(
color: bottomShared ? Colors.transparent : activeColor,
child: ChatCenterStageKeys(
controller: ChatCenterStageController.instance,
enabled: () =>
_workspaceVisible &&
_workspace.paneCount > 0 &&
showsListBesideDetail(context) &&
_chatOwnsKeyboard(),
child: ChatWorkspace(
key: _workspaceKey,
centerStage: ChatCenterStageController.instance,
paneColor: (pane) =>
chatColorShade(context, chatSessionColor(_rowFor(pane.sessionId))),
controller: _workspace,
onVisibleSessionIdsChanged: _workspaceVisibilityChanged,
shortcutsEnabled: _workspaceVisible,
singlePane: !showsListBesideDetail(context),
mobilePeeks: true,
paneTitle: (pane) =>
'${_rowFor(pane.sessionId)?['title'] ?? pane.sessionId}',
onFocusPane: (pane) => _composerFocus.request(pane.sessionId),
paneBuilder: (context, pane, active) {
final scope = ChatWorkspacePaneScope.maybeOf(context);
final topShared = scope?.topEdgeShared ?? false;
final bottomShared = scope?.bottomEdgeShared ?? false;
final leftShared = scope?.leftEdgeShared ?? false;
final rightShared = scope?.rightEdgeShared ?? false;
final activeColor = _workspace.paneCount > 1 && active
? chatColorShade(
context,
chatSessionColor(_rowFor(pane.sessionId)),
) ??
(chatControlsStyleOf(context) == ChatControlsStyle.cupertino
? CupertinoTheme.of(context).primaryColor
: Theme.of(context).colorScheme.primary)
: Colors.transparent;
return Semantics(
selected: active,
child: AnimatedContainer(
duration: showsListBesideDetail(context)
? Motion.of(context, Motion.standard)
: Duration.zero,
curve: Motion.curve,
foregroundDecoration: BoxDecoration(
border: showsListBesideDetail(context)
? Border(
top: bottomShared && !topShared
? BorderSide(color: activeColor)
: BorderSide.none,
bottom: BorderSide(
color: bottomShared
? Colors.transparent
: activeColor,
),
left: bottomShared && topShared && !leftShared
? BorderSide(color: activeColor)
: BorderSide.none,
right:
bottomShared &&
topShared &&
leftShared &&
!rightShared
? BorderSide(color: activeColor)
: BorderSide.none,
)
: Border(
bottom: BorderSide(
color: bottomShared
? Colors.transparent
: activeColor,
),
),
left: bottomShared && topShared && !leftShared
? BorderSide(color: activeColor)
: BorderSide.none,
right:
bottomShared &&
topShared &&
leftShared &&
!rightShared
? BorderSide(color: activeColor)
: BorderSide.none,
)
: Border(
bottom: BorderSide(
color: bottomShared ? Colors.transparent : activeColor,
),
),
),
// Every pane's bar carries its own chat's colour; beside the
// active pane the others fade theirs.
child: ChatPaneActivity(
inactive: _workspace.paneCount > 1 && !active,
child: DetailPane(
key: ValueKey('chat-pane-detail-${pane.id}'),
destination: AppDestination.chat,
implyBack: false,
builder: (context) => _thread(
pane.sessionId,
_back,
pane: pane,
paneContext: context,
),
// Every pane's bar carries its own chat's colour; beside the
// active pane the others fade theirs.
child: ChatPaneActivity(
inactive: _workspace.paneCount > 1 && !active,
child: DetailPane(
key: ValueKey('chat-pane-detail-${pane.id}'),
destination: AppDestination.chat,
implyBack: false,
builder: (context) => _thread(
pane.sessionId,
_back,
pane: pane,
paneContext: context,
),
),
),
),
),
);
},
);
},
),
),
);
}