mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 18:16:54 +08:00
opt pub textfield
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3261,8 +3261,6 @@ class EditableTextState extends State<EditableText>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void updateEditingValueWithDeltas(List<TextEditingDelta> textEditingDeltas) {
|
void updateEditingValueWithDeltas(List<TextEditingDelta> textEditingDeltas) {
|
||||||
TextEditingValue value = _value;
|
|
||||||
|
|
||||||
var last = textEditingDeltas.lastOrNull;
|
var last = textEditingDeltas.lastOrNull;
|
||||||
if (last case TextEditingDeltaInsertion e) {
|
if (last case TextEditingDeltaInsertion e) {
|
||||||
if (e.textInserted == '@') {
|
if (e.textInserted == '@') {
|
||||||
@@ -3279,14 +3277,12 @@ class EditableTextState extends State<EditableText>
|
|||||||
_atUserRegex.firstMatch(text.substring(0, offset));
|
_atUserRegex.firstMatch(text.substring(0, offset));
|
||||||
|
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
_lastKnownRemoteTextEditingValue = value;
|
updateEditingValue(TextEditingDeltaDeletion(
|
||||||
_value = TextEditingDeltaDeletion(
|
|
||||||
oldText: e.oldText,
|
oldText: e.oldText,
|
||||||
deletedRange: TextRange(start: match.start, end: match.end),
|
deletedRange: TextRange(start: match.start, end: match.end),
|
||||||
selection: TextSelection.collapsed(offset: match.start),
|
selection: TextSelection.collapsed(offset: match.start),
|
||||||
composing: e.composing,
|
composing: e.composing,
|
||||||
).apply(value);
|
).apply(_value));
|
||||||
widget.onChanged?.call(_value.text);
|
|
||||||
widget.onDelAtUser?.call(match.group(0)!.trim());
|
widget.onDelAtUser?.call(match.group(0)!.trim());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3295,21 +3291,8 @@ class EditableTextState extends State<EditableText>
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (final TextEditingDelta delta in textEditingDeltas) {
|
for (final TextEditingDelta delta in textEditingDeltas) {
|
||||||
value = delta.apply(value);
|
updateEditingValue(delta.apply(_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastKnownRemoteTextEditingValue = value;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
_value = value;
|
|
||||||
|
|
||||||
widget.onChanged?.call(value.text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user