8e98651db6
Keep the Material-only chat shell path while preserving public Cupertino parameters for callers. Narrow matching tests to the supported Material host.
66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../conversation/chat_card_styles.dart';
|
|
import 'chat_shell_run.dart';
|
|
import 'chat_shell_runs_controller.dart';
|
|
import 'chat_shell_terminal_keys.dart';
|
|
import 'chat_shell_terminal_view.dart';
|
|
|
|
/// The output area of one command card: the run's terminal emulator, which
|
|
/// takes typing while the command runs (with the key toolbar below it), or
|
|
/// its retained output read-only once it ended.
|
|
class ChatShellOutputView extends StatelessWidget {
|
|
const ChatShellOutputView({
|
|
super.key,
|
|
required this.run,
|
|
required this.controller,
|
|
required this.cupertino,
|
|
required this.viewKey,
|
|
required this.fullScreen,
|
|
});
|
|
|
|
final ChatShellRun run;
|
|
final ChatShellRunsController controller;
|
|
final bool cupertino;
|
|
|
|
/// Replaced when the full-screen view closes, so the card's view sizes the
|
|
/// terminal to itself again.
|
|
final Key viewKey;
|
|
|
|
/// True while the full-screen view sizes the terminal.
|
|
final bool fullScreen;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (!run.running && run.output.isEmpty) {
|
|
return Text(
|
|
'No output.',
|
|
key: const Key('chat-shell-output-empty'),
|
|
style: chatCardSecondaryStyle(context, false),
|
|
);
|
|
}
|
|
final session = controller.terminals.session(run);
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
ChatShellTerminalView(
|
|
key: viewKey,
|
|
session: session,
|
|
cupertino: false,
|
|
autoResize: !fullScreen,
|
|
),
|
|
if (session.live && !fullScreen)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8),
|
|
child: ChatShellTerminalKeys(
|
|
session: session,
|
|
cupertino: false,
|
|
field: chatShellTouchFirst(),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|