ca2f7eee32
AppDesign builds each design's light and dark ThemeData with an AppDesignTokens extension (corner radius, flat surfaces, frame colour, ANSI accents, prompt glyph). Settings gains a Design picker stored per device; the theme hosts rebuild live. Terminal is monospace (bundled RobotoMono), near-black or paper, flat 1px frames with 3px corners, and draws the chat transcript as prompt lines, tool dot/result lines and bracketed follow-up lines. Default keeps its exact themes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
137 lines
4.6 KiB
Dart
137 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../ui/status/run_status_icon.dart';
|
|
import '../../../ui/text/monospace.dart';
|
|
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
|
import '../domain/check_step_output.dart';
|
|
|
|
/// The note under a command whose recorded output the server cut short.
|
|
const String checkOutputTruncated =
|
|
'The server truncated this output at its capture limit.';
|
|
|
|
/// The body of a command that recorded no output.
|
|
const String checkOutputEmpty = 'No output recorded.';
|
|
|
|
/// A check visit's Output: its summary, a delivery-gate marker, one
|
|
/// expandable row per command and the handoff document the next stage reads.
|
|
class RunCheckOutputView extends StatelessWidget {
|
|
const RunCheckOutputView({super.key, required this.output});
|
|
|
|
final CheckStepOutput output;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final summary = output.summary;
|
|
final markdown = output.markdown;
|
|
return Column(
|
|
key: const Key('run-check-output'),
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
if (output.delivery)
|
|
Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: Chip(
|
|
key: const Key('run-check-delivery'),
|
|
avatar: const Icon(Icons.verified_outlined),
|
|
label: const Text('Delivery gate'),
|
|
),
|
|
),
|
|
if (summary != null)
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
child: SelectableText(summary, style: theme.textTheme.bodyLarge),
|
|
),
|
|
if (output.checks.isEmpty)
|
|
const Text('No commands were recorded.')
|
|
else
|
|
for (final (index, check) in output.checks.indexed)
|
|
RunCheckCommandRow(
|
|
key: ValueKey('run-check-command-$index'),
|
|
check: check,
|
|
),
|
|
if (markdown != null) ...[
|
|
const SizedBox(height: 12),
|
|
Text('Handoff', style: theme.textTheme.titleSmall),
|
|
const SizedBox(height: 4),
|
|
ChatMarkdownView(text: markdown),
|
|
],
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
/// One command: a status icon, the command, its status, exit code and
|
|
/// duration; expanding it shows the recorded output as selectable monospace.
|
|
class RunCheckCommandRow extends StatelessWidget {
|
|
const RunCheckCommandRow({super.key, required this.check});
|
|
|
|
final CheckCommandResult check;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final mono = (theme.textTheme.bodyMedium ?? const TextStyle()).copyWith(
|
|
fontFamily: appMonospaceFamily,
|
|
);
|
|
final color = runStatusColorOf(context, _state(check.status));
|
|
final meta = check.meta;
|
|
return ExpansionTile(
|
|
tilePadding: EdgeInsets.zero,
|
|
childrenPadding: const EdgeInsets.only(bottom: 12),
|
|
expandedCrossAxisAlignment: CrossAxisAlignment.stretch,
|
|
leading: Icon(
|
|
_icon(check.status),
|
|
color: color,
|
|
semanticLabel: checkStatusLabel(check),
|
|
),
|
|
title: Text(
|
|
check.command.isEmpty ? '(no command)' : check.command,
|
|
style: mono,
|
|
),
|
|
subtitle: Text(
|
|
[checkStatusLabel(check), if (meta.isNotEmpty) meta].join(' · '),
|
|
),
|
|
children: [
|
|
if (check.output.isEmpty)
|
|
const Text(checkOutputEmpty)
|
|
else
|
|
DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.surfaceContainerHighest,
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: SelectableText(check.output, style: mono),
|
|
),
|
|
),
|
|
if (check.truncated)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 4),
|
|
child: Text(
|
|
checkOutputTruncated,
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: theme.colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
static String _state(CheckCommandStatus status) => switch (status) {
|
|
CheckCommandStatus.passed => 'succeeded',
|
|
CheckCommandStatus.failed || CheckCommandStatus.timedOut => 'failed',
|
|
CheckCommandStatus.notRun || CheckCommandStatus.unknown => 'unknown',
|
|
};
|
|
|
|
static IconData _icon(CheckCommandStatus status) => switch (status) {
|
|
CheckCommandStatus.passed => Icons.check_circle_outline,
|
|
CheckCommandStatus.failed => Icons.cancel_outlined,
|
|
CheckCommandStatus.timedOut => Icons.timer_off_outlined,
|
|
CheckCommandStatus.notRun => Icons.remove_circle_outline,
|
|
CheckCommandStatus.unknown => Icons.help_outline,
|
|
};
|
|
}
|