mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
Merge pull request #25 from Iconica-Development/0.4.1
fix: update GroupAvatarBuilder so the groupName is available
This commit is contained in:
commit
d870b8424b
11 changed files with 32 additions and 14 deletions
|
@ -1,3 +1,7 @@
|
|||
## 0.4.1 - November 22 2023
|
||||
|
||||
- Add groupName for groupchat avatarbuilder
|
||||
|
||||
## 0.4.0 - November 6 2023
|
||||
|
||||
- Show amount of unread messages per chat
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat
|
||||
description: A new Flutter package project.
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
|
||||
publish_to: none
|
||||
|
||||
|
@ -19,12 +19,12 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_view
|
||||
ref: 0.4.0
|
||||
ref: 0.4.1
|
||||
flutter_community_chat_interface:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_interface
|
||||
ref: 0.4.0
|
||||
ref: 0.4.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^2.0.0
|
||||
|
|
|
@ -493,6 +493,6 @@ class FirebaseChatService implements ChatService {
|
|||
.doc(currentUser!.id!)
|
||||
.collection('chats')
|
||||
.doc(chat.id)
|
||||
.update({'amount_unread_messages': 0});
|
||||
.set({'amount_unread_messages': 0}, SetOptions(merge: true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,10 +84,20 @@ class FirebaseMessageService implements MessageService {
|
|||
.doc(userId)
|
||||
.collection('chats')
|
||||
.doc(chat.id);
|
||||
|
||||
await userReference.update({
|
||||
'amount_unread_messages': FieldValue.increment(1),
|
||||
});
|
||||
// what if the amount_unread_messages field does not exist?
|
||||
// it should be created when the chat is create
|
||||
if ((await userReference.get())
|
||||
.data()
|
||||
?.containsKey('amount_unread_messages') ??
|
||||
false) {
|
||||
await userReference.update({
|
||||
'amount_unread_messages': FieldValue.increment(1),
|
||||
});
|
||||
} else {
|
||||
await userReference.set({
|
||||
'amount_unread_messages': 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat_firebase
|
||||
description: A new Flutter package project.
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
@ -23,7 +23,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_interface
|
||||
ref: 0.4.0
|
||||
ref: 0.4.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^2.0.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat_interface
|
||||
description: A new Flutter package project.
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
|
|
@ -18,7 +18,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_view
|
||||
ref: 0.4.0
|
||||
ref: 0.4.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
@ -104,6 +104,7 @@ Widget _createUserAvatar(
|
|||
size: size,
|
||||
);
|
||||
Widget _createGroupAvatar(
|
||||
String groupName,
|
||||
String imageUrl,
|
||||
double size,
|
||||
) =>
|
||||
|
@ -158,6 +159,7 @@ typedef UserAvatarBuilder = Widget Function(
|
|||
);
|
||||
|
||||
typedef GroupAvatarBuilder = Widget Function(
|
||||
String groupName,
|
||||
String imageUrl,
|
||||
double size,
|
||||
);
|
||||
|
|
|
@ -116,6 +116,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
: [
|
||||
if (widget.chat is GroupChatModel) ...[
|
||||
widget.options.groupAvatarBuilder(
|
||||
(widget.chat! as GroupChatModel).title,
|
||||
(widget.chat! as GroupChatModel).imageUrl,
|
||||
36.0,
|
||||
),
|
||||
|
|
|
@ -161,6 +161,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||
: '',
|
||||
avatar:
|
||||
widget.options.groupAvatarBuilder(
|
||||
chat.title,
|
||||
chat.imageUrl,
|
||||
40.0,
|
||||
),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat_view
|
||||
description: A standard flutter package.
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
|
||||
publish_to: none
|
||||
|
||||
|
@ -20,7 +20,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_interface
|
||||
ref: 0.4.0
|
||||
ref: 0.4.1
|
||||
cached_network_image: ^3.2.2
|
||||
flutter_image_picker:
|
||||
git:
|
||||
|
|
Loading…
Reference in a new issue