Files
alan 96de9f5bea Remove Cupertino chat conversation branches
Keep the Material-only conversation implementation while preserving public Cupertino parameters for callers. Narrow affected tests to Material hosts so the dead platform paths are no longer exercised.
2026-11-11 13:11:05 +00:00

76 lines
2.3 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../domain/chat_task_metadata.dart';
import 'chat_task_presentation.dart';
/// Icon-labelled facts, kept distinct from the task's headline and progress.
class ChatTaskMetadataView extends StatelessWidget {
const ChatTaskMetadataView({
super.key,
required this.shell,
required this.now,
this.detail = false,
});
final JsonMap shell;
final DateTime now;
final bool detail;
@override
Widget build(BuildContext context) {
final start = taskInstant(shell, 'started_at');
final duration = taskNumber(shell, 'duration_ms');
final updated = taskInstant(shell, 'updated_at');
final lastTool = taskText(shell, 'last_tool');
final tools = taskNumber(shell, 'tool_count');
final tokens = taskNumber(shell, 'token_count');
final facts = <Widget>[
if (!detail)
ChatTaskFact(
icon: Icons.schedule,
label: 'Started',
value: start == null
? 'Start time unavailable'
: formatTaskDate(context, start),
),
if (!detail && start != null && start.isAfter(now))
ChatTaskFact(
icon: Icons.info_outline,
label: 'Device clock',
value: 'Start time is ahead of this device’s clock',
),
if (!detail && start == null && duration != null)
ChatTaskFact(
icon: Icons.timer_outlined,
label: 'Reported runtime',
value: taskDuration(Duration(milliseconds: duration)),
),
if (!detail && tools != null)
ChatTaskFact(
icon: Icons.build_outlined,
label: 'Tool calls',
value: formatTaskCount(tools),
),
if (!detail && tokens != null)
ChatTaskFact(
icon: Icons.token_outlined,
label: 'Tokens',
value: formatTaskCount(tokens),
),
if (detail && lastTool != null)
ChatTaskFact(
icon: Icons.build_outlined,
label: 'Last tool',
value: lastTool,
),
if (detail && updated != null)
ChatTaskFact(
icon: Icons.update,
label: 'Last update',
value: formatTaskDate(context, updated),
),
];
return Wrap(spacing: 24, runSpacing: 16, children: facts);
}
}