messages wip

This commit is contained in:
Christien Rioux 2024-05-27 18:04:00 -04:00
parent 17f6dfce46
commit 9c5feed732
18 changed files with 274 additions and 171 deletions

View file

@ -24,9 +24,9 @@ class ChatSingleContactItemWidget extends StatelessWidget {
BuildContext context,
) {
final activeChatCubit = context.watch<ActiveChatCubit>();
final remoteConversationRecordKey =
_contact.remoteConversationRecordKey.toVeilid();
final selected = activeChatCubit.state == remoteConversationRecordKey;
final localConversationRecordKey =
_contact.localConversationRecordKey.toVeilid();
final selected = activeChatCubit.state == localConversationRecordKey;
return SliderTile(
key: ObjectKey(_contact),
@ -38,7 +38,7 @@ class ChatSingleContactItemWidget extends StatelessWidget {
icon: Icons.chat,
onTap: () {
singleFuture(activeChatCubit, () async {
activeChatCubit.setActiveChat(remoteConversationRecordKey);
activeChatCubit.setActiveChat(localConversationRecordKey);
});
},
endActions: [
@ -49,7 +49,7 @@ class ChatSingleContactItemWidget extends StatelessWidget {
onPressed: (context) async {
final chatListCubit = context.read<ChatListCubit>();
await chatListCubit.deleteChat(
remoteConversationRecordKey: remoteConversationRecordKey);
localConversationRecordKey: localConversationRecordKey);
})
],
);

View file

@ -20,7 +20,7 @@ class ChatSingleContactListWidget extends StatelessWidget {
return contactListV.builder((context, contactList) {
final contactMap = IMap.fromIterable(contactList,
keyMapper: (c) => c.value.remoteConversationRecordKey,
keyMapper: (c) => c.value.localConversationRecordKey,
valueMapper: (c) => c.value);
final chatListV = context.watch<ChatListCubit>().state;
@ -36,7 +36,7 @@ class ChatSingleContactListWidget extends StatelessWidget {
initialList: chatList.map((x) => x.value).toList(),
itemBuilder: (c) {
final contact =
contactMap[c.remoteConversationRecordKey];
contactMap[c.localConversationRecordKey];
if (contact == null) {
return const Text('...');
}
@ -49,7 +49,7 @@ class ChatSingleContactListWidget extends StatelessWidget {
final lowerValue = value.toLowerCase();
return chatList.map((x) => x.value).where((c) {
final contact =
contactMap[c.remoteConversationRecordKey];
contactMap[c.localConversationRecordKey];
if (contact == null) {
return false;
}