claude_session_viewer/lib/screens/timeline/widgets/user_message_card.dart
Mathias Beaulieu-Duncan 364877d376 Initial commit: Claude Code session viewer (Flutter macOS)
A desktop app that parses Claude Code .jsonl session logs and provides
a rich UI for exploring conversations, tool usage, subagents, and token
consumption. Features include project browser with auto-discovery of
~/.claude/projects, conversation timeline with inline subagent expansion,
agents overview, toolbelt chart, and token usage dashboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:17:23 -04:00

82 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import '../../../models/log_entry.dart';
import '../../../theme/app_theme.dart';
class UserMessageCard extends StatelessWidget {
final UserEntry entry;
final int index;
const UserMessageCard({super.key, required this.entry, required this.index});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: AppColors.userBg,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: AppColors.user.withAlpha(40)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Header
Padding(
padding: const EdgeInsets.fromLTRB(14, 10, 14, 8),
child: Row(
children: [
Container(
width: 22,
height: 22,
decoration: BoxDecoration(
color: AppColors.user.withAlpha(40),
borderRadius: BorderRadius.circular(4),
),
child: const Icon(Icons.person, size: 14, color: AppColors.user),
),
const SizedBox(width: 8),
const Text(
'User',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: AppColors.user,
),
),
const SizedBox(width: 8),
Text(
'#$index',
style: const TextStyle(fontSize: 11, color: AppColors.textMuted),
),
const Spacer(),
if (entry.timestamp != null)
Text(
_formatTime(entry.timestamp!),
style: const TextStyle(fontSize: 11, color: AppColors.textMuted),
),
],
),
),
// Content
Padding(
padding: const EdgeInsets.fromLTRB(14, 0, 14, 12),
child: SelectableText(
entry.promptText,
style: const TextStyle(
fontSize: 13,
color: AppColors.textPrimary,
height: 1.5,
),
),
),
],
),
);
}
String _formatTime(DateTime dt) {
return '${dt.hour.toString().padLeft(2, '0')}:'
'${dt.minute.toString().padLeft(2, '0')}:'
'${dt.second.toString().padLeft(2, '0')}';
}
}