fix: suggestions menu and use empty map in html messages null return

This commit is contained in:
Jayesh Nirve 2022-02-02 13:07:33 +05:30
parent 0a6afa9da4
commit 54c26df9cf
No known key found for this signature in database
GPG Key ID: E9F26B1FCEB549BD
2 changed files with 5 additions and 5 deletions

View File

@ -95,7 +95,7 @@ class HtmlMessage extends StatelessWidget {
final identityParts = url.parseIdentifierIntoParts();
final identifier = identityParts?.primaryIdentifier;
if (identifier == null) {
return {'': null};
return {};
}
if (identifier.sigil == '@') {
// we have a user pill
@ -127,13 +127,13 @@ class HtmlMessage extends StatelessWidget {
};
}
}
return {'': null};
return {};
}
if (identifier.sigil == '!') {
// we have a room ID pill
final r = room.client.getRoomById(identifier);
if (r == null) {
return {'': null};
return {};
}
return {
'displayname':
@ -141,7 +141,7 @@ class HtmlMessage extends StatelessWidget {
'avatar_url': r.getState('m.room.avatar')?.content['url'],
};
}
return {'': null};
return {};
},
);
}

View File

@ -49,7 +49,7 @@ class InputBar extends StatelessWidget {
}
final searchText =
controller!.text.substring(0, controller!.selection.baseOffset);
final List<Map<String, String?>> ret = <Map<String, String>>[];
final List<Map<String, String?>> ret = <Map<String, String?>>[];
const maxResults = 30;
final commandMatch = RegExp(r'^\/([\w]*)$').firstMatch(searchText);