1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22: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 icon
leading: ConversationImageWidget( leading: ConversationImageWidget(
conversation: conversation, users: usersList), conversation: conversation,
users: usersList,
group: conversation.isGroupConversation
? groupsList.getGroup(conversation.groupID)
: null,
),
// Conversation information // Conversation information
isThreeLine: true, isThreeLine: true,

View File

@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:comunic/lists/users_list.dart'; import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/conversation.dart'; import 'package:comunic/models/conversation.dart';
import 'package:comunic/models/group.dart';
import 'package:comunic/models/user.dart'; import 'package:comunic/models/user.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart'; import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -13,13 +14,15 @@ class ConversationImageWidget extends StatelessWidget {
final Conversation conversation; final Conversation conversation;
final UsersList users; final UsersList users;
final double size; final double size;
final Group group;
const ConversationImageWidget( const ConversationImageWidget({
{Key key, Key key,
@required this.conversation, @required this.conversation,
@required this.users, @required this.users,
this.size = 30}) this.group,
: assert(conversation != null), this.size = 30,
}) : assert(conversation != null),
assert(users != null), assert(users != null),
assert(size > 0), assert(size > 0),
super(key: key); super(key: key);
@ -40,6 +43,13 @@ class ConversationImageWidget extends StatelessWidget {
width: size, width: size,
); );
if (group != null) {
return CachedNetworkImage(
imageUrl: group.iconURL,
width: size,
);
}
if (conversation.members.length < 2) if (conversation.members.length < 2)
return Icon( return Icon(
Icons.lock, Icons.lock,