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