7d2c3412a1
Adds the Paper design and generalises design tokens (transcript, composer, selected-row styles, reading type, panel fill, chat colour saturation). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.6 KiB
Dart
78 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/api_gateway.dart';
|
|
import '../domain/run_outcome_line.dart';
|
|
import '../../../ui/theme/app_design_tokens.dart';
|
|
|
|
/// The run Summary's prominent "Why it failed" note: a failed run's recorded
|
|
/// failure reason (else its diagnostic), selectable, at the top of the
|
|
/// Summary so the reason is read before the facts. Nothing for other runs.
|
|
///
|
|
/// [actions] (the run's Retry, Run again… and Open in chat; see
|
|
/// `RunFailureActions`) sit under the reason, so what to do next is beside
|
|
/// why it failed.
|
|
class RunFailureBanner extends StatelessWidget {
|
|
const RunFailureBanner({super.key, required this.run, this.actions});
|
|
|
|
final JsonMap run;
|
|
final Widget? actions;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final outcome = runOutcomeLine(run);
|
|
if (outcome == null || !outcome.failed) return const SizedBox.shrink();
|
|
final theme = Theme.of(context);
|
|
final scheme = theme.colorScheme;
|
|
return Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
|
child: DecoratedBox(
|
|
key: const Key('run-failure-banner'),
|
|
decoration: ShapeDecoration(
|
|
color: scheme.errorContainer,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: AppDesignTokens.of(
|
|
context,
|
|
).corners(BorderRadius.circular(12)),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Icon(Icons.error_outline, color: scheme.onErrorContainer),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Why it failed',
|
|
style: theme.textTheme.titleSmall?.copyWith(
|
|
color: scheme.onErrorContainer,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
SelectableText(
|
|
outcome.full,
|
|
maxLines: 6,
|
|
minLines: 1,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: scheme.onErrorContainer,
|
|
),
|
|
),
|
|
if (actions case final actions?) ...[
|
|
const SizedBox(height: 8),
|
|
actions,
|
|
],
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|