Files
pipelines/app/lib/features/chat/conversation/chat_quick_switch_row.dart
T
alan 141661e355 Chat: Ctrl+K / Alt+K on Chat opens a quick switcher for the open chats
On Chat the chord now toggles a centred dialog (bottom sheet on a phone)
with an autofocused filter over the open chats in list order; Ctrl+N/Down
and Ctrl+P/Up move the wrapping selection, Enter opens the chat as Ctrl+Tab
does (pane reused, composer focused), Esc or the chord closes it. From other
destinations the chord still jumps to Chat. Ctrl+N/Ctrl+P are handled so the
web page prevents their defaults (Ctrl+P no longer prints); a browser tab
keeps Ctrl+N reserved, documented in the help and notes/chat-quick-switch.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 12:27:39 +00:00

63 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../domain/chat_list_activity.dart';
import '../domain/chat_sessions.dart';
import '../ui/sessions/session_row_content.dart';
import '../ui/sessions/session_row_style.dart';
/// One chat in the quick switcher: the list's avatar (harness mark in the
/// chat's colour, with its running or awaiting badge), the title, and the
/// folder with the machine it is on. The selected row takes the selection
/// fill; hover and click work as on any list tile.
class ChatQuickSwitchRow extends StatelessWidget {
const ChatQuickSwitchRow({
super.key,
required this.session,
required this.selected,
required this.onTap,
this.serverName,
});
final JsonMap session;
final bool selected;
final VoidCallback onTap;
final String? serverName;
@override
Widget build(BuildContext context) {
final id = '${session['id'] ?? ''}';
final scheme = Theme.of(context).colorScheme;
final running = session['running'] == true;
final subtitle = [
homeRelativePath('${session['directory'] ?? ''}'.trim()),
?serverName,
].where((part) => part.isNotEmpty).join(' · ');
return ListTile(
key: Key('chat-quick-switch-row-$id'),
selected: selected,
selectedTileColor: scheme.secondaryContainer,
selectedColor: scheme.onSecondaryContainer,
visualDensity: VisualDensity.compact,
leading: ChatSessionAvatar(
session: session,
running: running,
backgroundTasks: running ? 0 : chatSessionBackgroundTasks(session),
awaitingOperator: chatSessionAwaitingOperator(session),
),
title: Text(
chatSessionTitle(session),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
subtitle: subtitle.isEmpty
? null
: Text(subtitle, maxLines: 1, overflow: TextOverflow.ellipsis),
trailing: session['starred'] == true
? Icon(Icons.star, color: scheme.primary, semanticLabel: 'Starred')
: null,
onTap: onTap,
);
}
}