addTextBeforeCursor method
在光标前插入文本
Implementation
void addTextBeforeCursor(String text) {
String value = this.text;
int start = selection.start;
String newValue = value.substring(0, start) + text + value.substring(start);
int newSelection = start + text.length;
this.value = this.value.copyWith(
text: newValue,
selection: TextSelection.collapsed(offset: newSelection));
}