Files
alan 9551eceaed Complete Material-only APIs and fixtures
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
2026-11-11 21:55:39 +00:00

49 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import '../conversation/chat_card_styles.dart';
import 'chat_shell_command.dart';
import 'chat_shell_run.dart';
/// A command's state at the card's top end: the host's activity indicator
/// while it runs, then a status chip (exit code, stopped, interrupted) with
/// how long it ran. The words carry the state; colour only repeats it.
class ChatShellStatus extends StatelessWidget {
const ChatShellStatus({super.key, required this.run});
final ChatShellRun run;
@override
Widget build(BuildContext context) {
if (run.running) {
return Semantics(
key: const Key('chat-shell-run-running'),
label: chatShellStatusLabel(run),
// As tall as the line of text beside it, at any text scale.
child: SizedBox.square(
dimension: MediaQuery.textScalerOf(context).scale(20),
child: const CircularProgressIndicator(strokeWidth: 2),
),
);
}
final label = run.durationMs > 0
? '${chatShellStatusLabel(run)} · ${chatShellDuration(run.durationMs)}'
: chatShellStatusLabel(run);
final color = switch (run.state) {
ChatShellRunState.succeeded => Theme.of(context).colorScheme.primary,
ChatShellRunState.failed => chatCardErrorColor(context),
_ => chatCardSecondaryColor(context),
};
final icon = switch (run.state) {
ChatShellRunState.succeeded => Icons.check_circle_outline,
ChatShellRunState.failed => Icons.error_outline,
_ => Icons.stop_circle_outlined,
};
return Chip(
key: const Key('chat-shell-run-status'),
avatar: Icon(icon, color: color),
label: Text(label),
visualDensity: VisualDensity.compact,
);
}
}