refactor: Update Matrix SDK

This commit is contained in:
Christian Pauly 2022-05-14 09:51:21 +02:00
commit 355abeb17f
10 changed files with 48 additions and 53 deletions

View file

@ -54,7 +54,7 @@ class _ContactsState extends State<ContactsList> {
final contactList = Matrix.of(context)
.client
.contactList
.where((p) => p.senderId
.where((p) => p.userid
.toLowerCase()
.contains(widget.searchController.text.toLowerCase()))
.toList();
@ -66,17 +66,16 @@ class _ContactsState extends State<ContactsList> {
}
class _ContactListTile extends StatelessWidget {
final Presence contact;
final CachedPresence contact;
const _ContactListTile({Key? key, required this.contact}) : super(key: key);
@override
Widget build(BuildContext context) {
return FutureBuilder<Profile>(
future:
Matrix.of(context).client.getProfileFromUserId(contact.senderId),
future: Matrix.of(context).client.getProfileFromUserId(contact.userid),
builder: (context, snapshot) {
final displayname = snapshot.data?.displayName ??
contact.senderId.localpart ??
contact.userid.localpart ??
'No valid MXID';
final avatarUrl = snapshot.data?.avatarUrl;
return ListTile(
@ -104,7 +103,7 @@ class _ContactListTile extends StatelessWidget {
),
title: Text(displayname),
subtitle: Text(contact.getLocalizedStatusMessage(context),
style: contact.presence.statusMsg?.isNotEmpty ?? false
style: contact.statusMsg?.isNotEmpty ?? false
? TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
@ -112,9 +111,7 @@ class _ContactListTile extends StatelessWidget {
: null),
onTap: () => VRouter.of(context).toSegments([
'rooms',
Matrix.of(context)
.client
.getDirectChatFromUserId(contact.senderId)!
Matrix.of(context).client.getDirectChatFromUserId(contact.userid)!
]),
);
});