-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Description
I wanna ask like fb, when user A is mentioned, then we can't mention duplicate A. So how to implement such a function? Thanks
I'm trying to delete user mention has been chosen on onSearchChanged, but after that an user mention before has been remove from markup too. You can see this in my attach image

onSearchChanged:
(String trigger, String value) {
if (trigger == "@") {
if (_debounce?.isActive ?? false)
_debounce!.cancel();
_debounce = Timer(
const Duration(milliseconds: 200),
() {
setState(() {
mentiondata.clear();
final List<Map<String, dynamic>>
mentionTemp = [];
mentionTemp.addAll([
{
"id": "3",
"display": "fayeedP",
"photo":
"https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg"
},
{
"id": "5",
"display": "khaled",
"photo":
"https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg",
},
]);
String text = _bloc.key.currentState!
.controller!.markupText;
RegExp regex = RegExp(
r"@\[\__([a-zA-Z0-9]+)__\]");
Iterable<Match> matches =
regex.allMatches(text);
List<String> results = [];
for (Match match in matches) {
results.add(match.group(1)!);
}
results.forEach((item) {
mentionTemp.removeWhere((element) =>
element['id'] == item);
});
mentiondata = mentionTemp;
});
});
}
},
Metadata
Metadata
Assignees
Labels
No labels