1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-21 20:39:22 +00:00

Can show group logo as group conversations logo

This commit is contained in:
Pierre HUBERT 2021-04-25 16:03:40 +02:00
parent 7db08f2653
commit 88217202f8
2 changed files with 22 additions and 7 deletions

View File

@ -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,

View File

@ -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,