Files
alan 214bbbc54f Remove Cupertino branches from terminal chat shell
Keep the existing Material terminal and chat-shell behavior while removing live Cupertino widgets, icon metadata, and alternate-host branches. Retain only the documented optional compatibility parameters until remaining callers migrate.
2026-11-11 20:05:55 +00:00

52 lines
1.6 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar_overflow.dart';
import 'chat_shell_runs_controller.dart';
const String chatShellDismissLabel = 'Dismiss';
const String chatShellDismissAllLabel = 'Dismiss all finished commands';
/// The card's Dismiss button, offered once the command has finished.
class ChatShellDismissButton extends StatelessWidget {
const ChatShellDismissButton({super.key, required this.onPressed});
final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
return IconButton(
key: const Key('chat-shell-run-dismiss'),
tooltip: chatShellDismissLabel,
icon: const Icon(Icons.close),
onPressed: onPressed,
);
}
}
/// The conversation's "Dismiss all finished commands" More menu entry.
Widget chatShellDismissAllMenuAction({required VoidCallback onPressed}) =>
SegmentedOverflowAction(
key: const ValueKey<String>('chat-shell-dismiss-all-action'),
overflowEntry: SegmentedOverflowEntry(
label: chatShellDismissAllLabel,
icon: Icons.clear_all,
onPressed: onPressed,
),
child: const SizedBox.shrink(),
);
/// Dismisses [ids] for every client of the chat. The card simply goes away;
/// no notice is shown. A refusal goes to [onRefused].
Future<void> dismissChatShellRuns(
BuildContext context,
ChatShellRunsController controller,
List<String> ids, {
void Function(String refusal)? onRefused,
}) async {
if (ids.isEmpty) return;
final refusal = await controller.dismiss(ids);
if (refusal != null) onRefused?.call(refusal);
}