feat: Nicer mentions
This commit is contained in:
parent
e048625804
commit
53bb9f3edd
2 changed files with 4 additions and 3 deletions
|
|
@ -86,7 +86,7 @@ class ChatView extends StatelessWidget {
|
||||||
outerContext: context,
|
outerContext: context,
|
||||||
onMention: () => controller
|
onMention: () => controller
|
||||||
.sendController.text +=
|
.sendController.text +=
|
||||||
'${controller.room.directChatMatrixID} ',
|
'${controller.room.getUserByMXIDSync(controller.room.directChatMatrixID).mention} ',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: () => VRouter.of(context)
|
: () => VRouter.of(context)
|
||||||
|
|
@ -376,7 +376,7 @@ class ChatView extends StatelessWidget {
|
||||||
onMention: () => controller
|
onMention: () => controller
|
||||||
.sendController
|
.sendController
|
||||||
.text +=
|
.text +=
|
||||||
'${event.senderId} ',
|
'${event.sender.mention} ',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
unfold: controller.unfold,
|
unfold: controller.unfold,
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ class InputBar extends StatelessWidget {
|
||||||
ret.add({
|
ret.add({
|
||||||
'type': 'user',
|
'type': 'user',
|
||||||
'mxid': user.id,
|
'mxid': user.id,
|
||||||
|
'mention': user.mention,
|
||||||
'displayname': user.displayName,
|
'displayname': user.displayName,
|
||||||
'avatar_url': user.avatarUrl?.toString(),
|
'avatar_url': user.avatarUrl?.toString(),
|
||||||
});
|
});
|
||||||
|
|
@ -324,7 +325,7 @@ class InputBar extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (suggestion['type'] == 'user') {
|
if (suggestion['type'] == 'user') {
|
||||||
insertText = suggestion['mxid'] + ' ';
|
insertText = suggestion['mention'] + ' ';
|
||||||
startText = replaceText.replaceAllMapped(
|
startText = replaceText.replaceAllMapped(
|
||||||
RegExp(r'(\s|^)(@[-\w]+)$'),
|
RegExp(r'(\s|^)(@[-\w]+)$'),
|
||||||
(Match m) => '${m[1]}$insertText',
|
(Match m) => '${m[1]}$insertText',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue