This commit is contained in:
pradeepkumar
2026-04-08 03:46:13 +05:30
parent 7737bcfd65
commit 7e4f879171

View File

@@ -433,8 +433,10 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
),
),
itemBuilder: (context, index) {
final currentUserId = ref.read(currentUserIdProvider);
return _ConversationTile(
conversation: filtered[index],
currentUserId: currentUserId,
onTap: () =>
context.push('/messages/chat/${filtered[index].id}'),
);
@@ -448,10 +450,12 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
class _ConversationTile extends StatelessWidget {
final Conversation conversation;
final String? currentUserId;
final VoidCallback onTap;
const _ConversationTile({
required this.conversation,
required this.currentUserId,
required this.onTap,
});
@@ -480,6 +484,9 @@ class _ConversationTile extends StatelessWidget {
final lastMessage = _formatPreview(conversation.lastMessageText ?? '');
final timestamp = _formatTimestamp(conversation.lastMessageAt);
final unread = conversation.unreadCount;
final isFavorited = currentUserId != null && conversation.userId == currentUserId
? conversation.userFavorited
: conversation.agentFavorited;
final firstLetter = otherParty.name.isNotEmpty
? otherParty.name[0].toUpperCase()
: '?';
@@ -560,6 +567,14 @@ class _ConversationTile extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
),
if (isFavorited) ...[
const SizedBox(width: 6),
const Icon(
Icons.star,
size: 16,
color: AppColors.accentOrange,
),
],
if (unread > 0) ...[
const SizedBox(width: 8),
Container(