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