diff --git a/lib/ui/tiles/conversation_tile.dart b/lib/ui/tiles/conversation_tile.dart index a070dde..b70f376 100644 --- a/lib/ui/tiles/conversation_tile.dart +++ b/lib/ui/tiles/conversation_tile.dart @@ -80,7 +80,12 @@ class ConversationTile extends StatelessWidget { // Leading icon leading: ConversationImageWidget( - conversation: conversation, users: usersList), + conversation: conversation, + users: usersList, + group: conversation.isGroupConversation + ? groupsList.getGroup(conversation.groupID) + : null, + ), // Conversation information isThreeLine: true, diff --git a/lib/ui/widgets/conversation_image_widget.dart b/lib/ui/widgets/conversation_image_widget.dart index 5e97de0..7cfd984 100644 --- a/lib/ui/widgets/conversation_image_widget.dart +++ b/lib/ui/widgets/conversation_image_widget.dart @@ -1,6 +1,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:comunic/lists/users_list.dart'; import 'package:comunic/models/conversation.dart'; +import 'package:comunic/models/group.dart'; import 'package:comunic/models/user.dart'; import 'package:comunic/ui/widgets/account_image_widget.dart'; import 'package:flutter/material.dart'; @@ -13,13 +14,15 @@ class ConversationImageWidget extends StatelessWidget { final Conversation conversation; final UsersList users; final double size; + final Group group; - const ConversationImageWidget( - {Key key, - @required this.conversation, - @required this.users, - this.size = 30}) - : assert(conversation != null), + const ConversationImageWidget({ + Key key, + @required this.conversation, + @required this.users, + this.group, + this.size = 30, + }) : assert(conversation != null), assert(users != null), assert(size > 0), super(key: key); @@ -40,6 +43,13 @@ class ConversationImageWidget extends StatelessWidget { width: size, ); + if (group != null) { + return CachedNetworkImage( + imageUrl: group.iconURL, + width: size, + ); + } + if (conversation.members.length < 2) return Icon( Icons.lock,