Merge branch 'main' into pipelines/run-20261112-2323-read-chat-replies-aloud-with-word-highli-e079

This commit is contained in:
2026-11-13 01:29:09 +00:00
18 changed files with 668 additions and 126 deletions
@@ -8,6 +8,7 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
required this.onPressed,
required this.materialIcon,
this.identifier,
this.destructive = false,
});
final String label;
@@ -16,12 +17,16 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
final String? identifier;
/// Closes or removes something; menus list it last, in the error colour.
final bool destructive;
/// A narrow bar moves it into its More menu, under the bar's host's icon.
@override
SegmentedOverflowEntry get overflowEntry => SegmentedOverflowEntry(
label: label,
icon: materialIcon,
onPressed: onPressed,
destructive: destructive,
);
@override
@@ -53,21 +53,27 @@ class SessionActionsButton extends StatelessWidget {
return AppOverflowMenu<Object>(
label: sessionActionsLabel(session, duplicateTitles),
sheetTitle: chatSessionTitle(session),
sheetSubtitle: '${session['directory'] ?? ''}'.trim().isEmpty
? null
: '${session['directory']}',
actionsBuilder: () => [
if (allowOpenBeside)
const AppMenuAction<Object>(
value: SessionAction.openBeside,
label: 'Open to the right',
icon: Icons.vertical_split_outlined,
),
if (allowOpenBelow)
const AppMenuAction<Object>(
value: SessionAction.openBelow,
label: 'Open below',
icon: Icons.horizontal_split_outlined,
),
if (allowFloat)
AppMenuAction<Object>(
value: SessionAction.float,
label: 'Float (${chatFloatShortcutLabel()})',
icon: Icons.picture_in_picture_alt_outlined,
),
for (final choice
in paneMenu?.choicesFor(context, session) ??
@@ -76,9 +82,16 @@ class SessionActionsButton extends StatelessWidget {
value: choice.action,
label: choice.label,
enabled: choice.enabled,
icon: _paneIcon(choice.action),
destructive: choice.action == SessionPaneAction.closePane,
),
for (final item in _items(session))
AppMenuAction<Object>(value: item.action, label: item.label),
AppMenuAction<Object>(
value: item.action,
label: item.label,
icon: item.icon,
destructive: item.action == SessionAction.close,
),
],
onSelected: (context, value) {
if (value is SessionAction) {
@@ -91,19 +104,51 @@ class SessionActionsButton extends StatelessWidget {
}
}
List<({SessionAction action, String label})> _items(JsonMap session) {
IconData _paneIcon(SessionPaneAction action) => switch (action) {
SessionPaneAction.addPane => Icons.add_box_outlined,
SessionPaneAction.openChats => Icons.view_quilt_outlined,
SessionPaneAction.centerStage => Icons.center_focus_strong_outlined,
SessionPaneAction.moveUp => Icons.arrow_upward,
SessionPaneAction.moveDown => Icons.arrow_downward,
SessionPaneAction.moveLeft => Icons.arrow_back,
SessionPaneAction.moveRight => Icons.arrow_forward,
SessionPaneAction.closePane => Icons.close,
SessionPaneAction.chatDetails => Icons.info_outline,
SessionPaneAction.files => Icons.folder_outlined,
SessionPaneAction.runCommand => Icons.terminal,
SessionPaneAction.openTerminal => Icons.terminal,
SessionPaneAction.dismissFinished => Icons.clear_all,
};
List<({SessionAction action, String label, IconData icon})> _items(
JsonMap session,
) {
final isClosed = session['closed_at'] != null;
final starred = session['starred'] == true;
return [
(
action: SessionAction.star,
label: session['starred'] == true ? 'Unstar' : 'Star',
label: starred ? 'Unstar' : 'Star',
icon: starred ? Icons.star : Icons.star_outline,
),
(
action: SessionAction.color,
label: 'Colour…',
icon: Icons.palette_outlined,
),
(action: SessionAction.rename, label: 'Rename…', icon: Icons.edit_outlined),
(
action: SessionAction.hide,
label: 'Hide on this device',
icon: Icons.visibility_off_outlined,
),
(action: SessionAction.color, label: 'Colour…'),
(action: SessionAction.rename, label: 'Rename…'),
isClosed
? (action: SessionAction.reopen, label: 'Reopen')
: (action: SessionAction.close, label: 'Close chat…'),
(action: SessionAction.hide, label: 'Hide on this device'),
? (action: SessionAction.reopen, label: 'Reopen', icon: Icons.restore)
: (
action: SessionAction.close,
label: 'Close chat…',
icon: Icons.close,
),
];
}