refactor: remove briefing digest card, show full message list directly
The summary card duplicated the first assistant message and consumed
screen real estate without benefit on small screens. Replaced with:
- Full message list via ChatMessageBubble from the top
- SliverFillRemaining empty state ("No briefing yet today" + generate button)
when no messages exist
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import '../../core/exceptions.dart';
|
import '../../core/exceptions.dart';
|
||||||
import '../../data/models/message.dart';
|
|
||||||
import '../../providers/briefing_provider.dart';
|
import '../../providers/briefing_provider.dart';
|
||||||
import '../../widgets/briefing_digest_card.dart';
|
|
||||||
import '../../widgets/chat_message_bubble.dart';
|
import '../../widgets/chat_message_bubble.dart';
|
||||||
import 'briefing_history_screen.dart';
|
import 'briefing_history_screen.dart';
|
||||||
|
|
||||||
@@ -146,59 +144,44 @@ class _BriefingScreenState extends ConsumerState<BriefingScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
data: (conv) {
|
data: (conv) {
|
||||||
// First assistant message for the digest card (null if none yet)
|
|
||||||
final Message? firstAssistant = conv.messages
|
|
||||||
.where((m) => m.role == MessageRole.assistant)
|
|
||||||
.toList()
|
|
||||||
.firstOrNull;
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
// Digest card + messages share one scroll view so expanding the
|
|
||||||
// card doesn't trap the user — the whole page just becomes taller.
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverToBoxAdapter(
|
if (conv.messages.isEmpty)
|
||||||
child: BriefingDigestCard(
|
SliverFillRemaining(
|
||||||
message: firstAssistant,
|
child: Center(
|
||||||
onGenerateNow: _refresh,
|
child: Column(
|
||||||
),
|
mainAxisSize: MainAxisSize.min,
|
||||||
),
|
children: [
|
||||||
|
Text(
|
||||||
if (conv.messages.isNotEmpty)
|
'No briefing yet today.',
|
||||||
SliverToBoxAdapter(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
||||||
child: Row(children: [
|
|
||||||
const Expanded(child: Divider()),
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: Text(
|
|
||||||
'Conversation',
|
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.labelSmall
|
.bodyMedium
|
||||||
?.copyWith(
|
?.copyWith(color: scheme.onSurfaceVariant),
|
||||||
color: scheme.onSurfaceVariant),
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 12),
|
||||||
const Expanded(child: Divider()),
|
FilledButton.tonal(
|
||||||
]),
|
onPressed: _refresh,
|
||||||
|
child: const Text('Generate now'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
SliverPadding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 8, vertical: 8),
|
||||||
|
sliver: SliverList.builder(
|
||||||
|
itemCount: conv.messages.length,
|
||||||
|
itemBuilder: (_, i) =>
|
||||||
|
ChatMessageBubble(message: conv.messages[i]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
SliverPadding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 8, vertical: 8),
|
|
||||||
sliver: SliverList.builder(
|
|
||||||
itemCount: conv.messages.length,
|
|
||||||
itemBuilder: (_, i) =>
|
|
||||||
ChatMessageBubble(message: conv.messages[i]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user