onEmojiBackPressed method
dynamic
onEmojiBackPressed()
Implementation
onEmojiBackPressed() {
var text = groupName.text;
var cursorPosition = groupName.selection.base.offset;
// If cursor is not set, then place it at the end of the textfield
if (cursorPosition < 0) {
groupName.selection = TextSelection(
baseOffset: groupName.text.length,
extentOffset: groupName.text.length,
);
cursorPosition = groupName.selection.base.offset;
}
if (cursorPosition >= 0) {
final selection = groupName.value.selection;
final newTextBeforeCursor =
selection.textBefore(text).characters.skipLast(1).toString();
LogMessage.d("newTextBeforeCursor", newTextBeforeCursor);
groupName
..text = newTextBeforeCursor + selection.textAfter(text)
..selection = TextSelection.fromPosition(
TextPosition(offset: newTextBeforeCursor.length));
}
_count((25 - groupName.text.characters.length));
}