b9e68e3bc8
Per-screen application of the design system to the Flutter app. Mirrors the web's surface phase landed in FabledScribe v26.04.28.1. Foundation port shipped in 0f05f47; this is the surface work. Lucide icon migration - Added lucide_icons ^0.257.0 dependency - 107 Material Icons references → LucideIcons across 21 files. Drop-in IconData swap (Icon(LucideIcons.X) instead of Icon(Icons.x)). - Lucide import added to each touched file. Input border radius - theme.dart inputDecorationTheme borderRadius 24 → 8 in both light and dark themes. Doc says radius-md (8px) for inputs; previous pill shape was Material default that the doc deviates from. Illuminated Transcript pattern (ChatMessageBubble) - User bubble: accent-tinted border → neutral Pewter (scheme.outline). Asymmetric corner already correct (bottomRight 4px). - Assistant bubble: topLeft corner 4 → 16; only bottomLeft stays 4 (the "tail" effect, mirroring web's `border-bottom-left-radius: 4px`). Background switched from surfaceContainerHighest (Slate) to surface (Iron) per the doc spec "card surface". - Assistant bubble glow shadow added — accent-tinted blur (28px alpha 0.14) + depth shadow (8px alpha 0.4 black). Mirrors web's --color-bubble-asst-shadow. ActionColors wiring (Hybrid rule) - 5 'Delete' confirm buttons across notes / tasks / chat conversations / calendar event sheet → Oxblood action-destructive via the ActionColors ThemeExtension defined in the foundation port. Foreground for ghost/text variants, backgroundColor for filled. - Calendar event Save button → Moss action-primary. The first call site to wire ActionColors.primary; serves as the pattern for future Save reclassifications. - Other Save buttons (note edit, task edit, project edit, etc.) still flow through colorScheme.primary (dusty violet) and read as brand-moment. Reclassifying those is deferred — the wiring pattern is established and can be applied incrementally as files are touched. Indigo cleanup - 4 hardcoded #7C3AED / #5B21B6 literals → dusty-violet equivalents (#5B4A8A / #3F3560). Spots: project_tasks_screen color fallback (×2), journal_screen gradient. Verification - flutter analyze: No issues found What's deferred - Per-screen Save / Cancel reclassification beyond the calendar event Save button. Wiring pattern established; rollout opportunistic. - Long-form 1.7 line-height on assistant Markdown content (would require MarkdownStyleSheet work; minor). - Surface walk on Knowledge / Projects / Settings screens for any hardcoded styling that needs touch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
133 lines
4.1 KiB
Dart
133 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lucide_icons/lucide_icons.dart';
|
|
import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
|
|
|
|
import '../data/models/message.dart';
|
|
|
|
class JournalPrepCard extends StatefulWidget {
|
|
/// The first assistant message from today's journal — the daily prep
|
|
/// (LLM-generated briefing-style opener), or null if not yet generated.
|
|
final Message? message;
|
|
|
|
/// Called when the user taps "Generate now".
|
|
final VoidCallback? onGenerateNow;
|
|
|
|
const JournalPrepCard({
|
|
super.key,
|
|
required this.message,
|
|
this.onGenerateNow,
|
|
});
|
|
|
|
@override
|
|
State<JournalPrepCard> createState() => _JournalPrepCardState();
|
|
}
|
|
|
|
class _JournalPrepCardState extends State<JournalPrepCard> {
|
|
bool _expanded = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final scheme = Theme.of(context).colorScheme;
|
|
final textTheme = Theme.of(context).textTheme;
|
|
|
|
return Card(
|
|
margin: const EdgeInsets.fromLTRB(12, 8, 12, 4),
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(14),
|
|
side: BorderSide(
|
|
color: scheme.outlineVariant.withValues(alpha: 0.5),
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(LucideIcons.bookOpen, size: 18, color: scheme.primary),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
_todayLabel(),
|
|
style: textTheme.labelMedium?.copyWith(
|
|
color: scheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 10),
|
|
if (widget.message == null) ...[
|
|
Text(
|
|
'No prep yet today.',
|
|
style: textTheme.bodyMedium?.copyWith(
|
|
color: scheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
if (widget.onGenerateNow != null)
|
|
FilledButton.tonal(
|
|
onPressed: widget.onGenerateNow,
|
|
child: const Text('Generate now'),
|
|
),
|
|
] else ...[
|
|
AnimatedSize(
|
|
duration: const Duration(milliseconds: 250),
|
|
curve: Curves.easeInOut,
|
|
alignment: Alignment.topCenter,
|
|
child: _expanded
|
|
? MarkdownBody(data: widget.message!.content)
|
|
: _TruncatedMarkdown(
|
|
data: widget.message!.content,
|
|
maxLines: 5,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
GestureDetector(
|
|
onTap: () => setState(() => _expanded = !_expanded),
|
|
child: Text(
|
|
_expanded ? 'Show less ↑' : 'Show more ↓',
|
|
style: TextStyle(
|
|
color: scheme.primary,
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String _todayLabel() {
|
|
final now = DateTime.now();
|
|
const days = [
|
|
'Monday', 'Tuesday', 'Wednesday', 'Thursday',
|
|
'Friday', 'Saturday', 'Sunday'
|
|
];
|
|
const months = [
|
|
'January', 'February', 'March', 'April', 'May', 'June',
|
|
'July', 'August', 'September', 'October', 'November', 'December'
|
|
];
|
|
return '${days[now.weekday - 1]}, ${months[now.month - 1]} ${now.day}';
|
|
}
|
|
}
|
|
|
|
/// Renders Markdown truncated to [maxLines] visible lines.
|
|
class _TruncatedMarkdown extends StatelessWidget {
|
|
final String data;
|
|
final int maxLines;
|
|
const _TruncatedMarkdown({required this.data, required this.maxLines});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ConstrainedBox(
|
|
constraints: BoxConstraints(maxHeight: maxLines * 20.0),
|
|
child: ClipRect(child: MarkdownBody(data: data)),
|
|
);
|
|
}
|
|
}
|