Files
pipelines/app/lib/features/chat/conversation/chat_background_task_detail.dart
T

70 lines
2.1 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../domain/chat_shells.dart';
import '../domain/chat_task_metadata.dart';
import 'chat_background_task_output.dart';
import 'chat_task_metadata_view.dart';
import 'chat_task_presentation.dart';
export 'chat_background_task_output.dart' show ChatBackgroundTaskButton;
/// Expanded facts add information instead of repeating the card's title/status.
class ChatBackgroundTaskDetail extends StatelessWidget {
const ChatBackgroundTaskDetail({
super.key,
required this.shell,
required this.now,
required this.output,
required this.heightBudget,
required this.onRefresh,
});
final JsonMap shell;
final DateTime now;
final ChatShellOutputSnapshot? output;
final double heightBudget;
final VoidCallback onRefresh;
@override
Widget build(BuildContext context) {
final cupertino = taskCupertino(context);
final command = taskText(shell, 'command');
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Wrap(
spacing: 24,
runSpacing: 16,
children: [
ChatTaskFact(
icon: cupertino ? CupertinoIcons.number : Icons.tag,
label: shellOutputTaskIdentityLabel,
value: shellIdOf(shell),
monospace: true,
),
if (command != null &&
!sameTaskText(command, taskDisplayTitle(shell)))
ChatTaskFact(
icon: cupertino
? CupertinoIcons.chevron_left_slash_chevron_right
: Icons.terminal,
label: shellOutputCommandLabel,
value: command,
monospace: true,
),
],
),
const SizedBox(height: 16),
ChatTaskMetadataView(shell: shell, now: now, detail: true),
const SizedBox(height: 20),
ChatBackgroundTaskOutput(
output: output,
heightBudget: heightBudget,
onRefresh: onRefresh,
),
],
);
}
}