automatically replace emoji

This commit is contained in:
Salvatore Giordano
2020-11-06 12:20:21 +01:00
parent b4646231fc
commit 3aababa282
+2 -2
View File
@@ -407,11 +407,11 @@ class MessageInputState extends State<MessageInput> {
final textToSelection = textEditingController.text final textToSelection = textEditingController.text
.substring(0, textEditingController.value.selection.start); .substring(0, textEditingController.value.selection.start);
final splits = textToSelection.split(':'); final splits = textToSelection.split(':');
final query = splits[1]?.toLowerCase(); final query = splits[splits.length - 2]?.toLowerCase();
final emoji = Emoji.byName(query); final emoji = Emoji.byName(query);
if (textToSelection.endsWith(':') && emoji != null) { if (textToSelection.endsWith(':') && emoji != null) {
_chooseEmoji(splits, emoji); _chooseEmoji(splits.sublist(0, splits.length - 1), emoji);
} else { } else {
_emojiOverlay = _buildEmojiOverlay(); _emojiOverlay = _buildEmojiOverlay();