updateEditingValue method
Requests that this client update its editing state to the given value.
The new value
is treated as user input and thus may subject to input
formatting.
Implementation
@override
void updateEditingValue(TextEditingValue value) {
// This method handles text editing state updates from the platform text
// input plugin. The [EditableText] may not have the focus or an open input
// connection, as autofill can update a disconnected [EditableText].
// Since we still have to support keyboard select, this is the best place
// to disable text updating.
if (!_shouldCreateInputConnection) {
return;
}
// // In the read-only case, we only care about selection changes, and reject
// // everything else.
value = _value.copyWith(selection: value.selection);
if (value == _value) {
// This is possible, for example, when the numeric keyboard is input,
// the engine will notify twice for the same value.
// Track at https://github.com/flutter/flutter/issues/65811
return;
}
if (value.text == _value.text && value.composing == _value.composing) {
// `selection` is the only change.
setState(() {
_value = _value.copyWith(selection: value.selection);
_handleSelectionChanged(
value.selection, SelectionChangedCause.keyboard);
});
} else {
//hideToolbar();
textEditingValue = value;
}
}