mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-15 22:56:15 +08:00
multi mention
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -240,24 +240,33 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
|
||||
double _mentionOffset = 0;
|
||||
Future<void> onMention([bool fromClick = false]) async {
|
||||
controller.keepChatPanel();
|
||||
await DynMentionPanel.onDynMention(
|
||||
final res = await DynMentionPanel.onDynMention(
|
||||
context,
|
||||
offset: _mentionOffset,
|
||||
callback: (offset) => _mentionOffset = offset,
|
||||
).then((MentionItem? res) {
|
||||
if (res != null) {
|
||||
onInsertText(
|
||||
'@${res.name} ',
|
||||
RichTextType.at,
|
||||
rawText: res.name,
|
||||
id: res.uid,
|
||||
fromClick: fromClick,
|
||||
);
|
||||
);
|
||||
if (res != null) {
|
||||
if (res is MentionItem) {
|
||||
_onInsertUser(res, fromClick);
|
||||
} else if (res is Iterable<MentionItem>) {
|
||||
for (var e in res) {
|
||||
_onInsertUser(e, fromClick);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
controller.restoreChatPanel();
|
||||
}
|
||||
|
||||
void _onInsertUser(MentionItem e, bool fromClick) {
|
||||
onInsertText(
|
||||
'@${e.name} ',
|
||||
RichTextType.at,
|
||||
rawText: e.name,
|
||||
id: e.uid,
|
||||
fromClick: fromClick,
|
||||
);
|
||||
}
|
||||
|
||||
void onInsertText(
|
||||
String text,
|
||||
RichTextType type, {
|
||||
|
||||
Reference in New Issue
Block a user