mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-26 12:58:51 +00:00
Fix unread conversations drop down
This commit is contained in:
parent
3257fd865f
commit
8f2574a555
@ -8,7 +8,7 @@ import 'package:comunic/models/unread_conversation.dart';
|
||||
class UnreadConversationsList extends AbstractList<UnreadConversation> {
|
||||
/// Get the ID of the users included in this list
|
||||
Set<int> get usersID {
|
||||
final set = Set();
|
||||
final set = Set<int>();
|
||||
forEach((element) => set.addAll(element.message.usersID));
|
||||
return set;
|
||||
}
|
||||
|
@ -224,7 +224,8 @@ class ConversationMessage extends SerializableElement<ConversationMessage> {
|
||||
Set<int> get usersID {
|
||||
if (userID != null) return Set()..add(userID);
|
||||
|
||||
return serverMessage.usersID;
|
||||
if (serverMessage != null) return serverMessage.usersID;
|
||||
return Set();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -3,8 +3,11 @@ import 'package:comunic/helpers/events_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/lists/unread_conversations_list.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||
import 'package:comunic/ui/widgets/conversation_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||
import 'package:comunic/utils/date_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -67,25 +70,41 @@ class _UnreadConversationsScreenState
|
||||
}
|
||||
|
||||
Widget _tileBuilder(BuildContext context, int index) {
|
||||
/*final conv = _list[index];
|
||||
final user = _users.getUser(conv.userID);
|
||||
final conv = _list[index];
|
||||
|
||||
final message = _list[index].message;
|
||||
|
||||
final singleUserConv = conv.conv.members.length < 3;
|
||||
|
||||
String messageStr;
|
||||
if (message.hasFile)
|
||||
messageStr = tr("New file");
|
||||
else if (message.hasMessage)
|
||||
messageStr = singleUserConv
|
||||
? message.message.content
|
||||
: tr("%1% : %2%", args: {
|
||||
"1": _users.getUser(message.userID).fullName,
|
||||
"2": message.message.content,
|
||||
});
|
||||
else
|
||||
message.serverMessage.getText(_users);
|
||||
|
||||
return ListTile(
|
||||
leading: AccountImageWidget(user: user),
|
||||
title: Text(user.displayName),
|
||||
leading: ConversationImageWidget(
|
||||
conversation: conv.conv,
|
||||
users: _users,
|
||||
),
|
||||
title: Text(ConversationsHelper.getConversationName(conv.conv, _users)),
|
||||
subtitle: RichText(
|
||||
text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [
|
||||
TextSpan(text: conv.convName.isNotEmpty ? conv.convName + "\n" : ""),
|
||||
TextSpan(
|
||||
text: conv.message,
|
||||
text: messageStr,
|
||||
style: TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
]),
|
||||
)
|
||||
trailing: Text(diffTimeFromNowToStr(conv.lastActive)),
|
||||
onTap: () => MainController.of(context).openConversation(conv.id),
|
||||
);*/
|
||||
|
||||
// TODO : reimplement
|
||||
throw new Exception("unimplemented");
|
||||
),
|
||||
trailing: Text(diffTimeFromNowToStr(conv.message.timeSent)),
|
||||
onTap: () => MainController.of(context).openConversation(conv.conv.id),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user