Files
pipelines/app/lib/features/chat/shell/chat_shell_run_dialog.dart
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

72 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import '../../../ui/text/monospace.dart';
import 'chat_shell_command.dart';
/// The chat actions menu's "Run command…": a small host dialog with one
/// command field. Returns the trimmed command, or null when cancelled.
Future<String?> showChatShellRunDialog(BuildContext context) =>
showDialog<String>(
context: context,
builder: (_) => const ChatShellRunDialog(),
);
class ChatShellRunDialog extends StatefulWidget {
const ChatShellRunDialog({super.key});
@override
State<ChatShellRunDialog> createState() => _ChatShellRunDialogState();
}
class _ChatShellRunDialogState extends State<ChatShellRunDialog> {
final TextEditingController _text = TextEditingController();
@override
void dispose() {
_text.dispose();
super.dispose();
}
void _submit() {
final command = _text.text.trim();
Navigator.pop(context, command.isEmpty ? null : command);
}
void _cancel() => Navigator.pop(context);
@override
Widget build(BuildContext context) {
const mono = TextStyle(fontFamily: appMonospaceFamily);
return AlertDialog(
title: const Text(chatShellRunDialogTitle),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text(chatShellModeHint),
const SizedBox(height: 12),
TextField(
key: const Key('chat-shell-run-field'),
controller: _text,
autofocus: true,
style: mono,
decoration: const InputDecoration(
labelText: 'Command',
prefixText: '\$ ',
),
onSubmitted: (_) => _submit(),
),
],
),
actions: [
TextButton(onPressed: _cancel, child: const Text('Cancel')),
FilledButton(
key: const Key('chat-shell-run-confirm'),
onPressed: _submit,
child: const Text(chatShellRunDialogConfirm),
),
],
);
}
}