EditableTextState should dispose cursorVisibilityNotifier. (#133858)
This commit is contained in:
parent
0d30546c74
commit
161c7090ff
@ -2125,7 +2125,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
late final Simulation _iosBlinkCursorSimulation = _DiscreteKeyFrameSimulation.iOSBlinkingCaret();
|
||||
|
||||
final ValueNotifier<bool> _cursorVisibilityNotifier = ValueNotifier<bool>(true);
|
||||
final ValueNotifier<bool> _debugCursorNotifier = ValueNotifier<bool>(true);
|
||||
final GlobalKey _editableKey = GlobalKey();
|
||||
|
||||
/// Detects whether the clipboard can paste.
|
||||
@ -2803,8 +2802,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
|
||||
_debugCursorNotifier.value = widget.showCursor;
|
||||
|
||||
_style = MediaQuery.boldTextOf(context)
|
||||
? widget.style.merge(const TextStyle(fontWeight: FontWeight.bold))
|
||||
: widget.style;
|
||||
@ -2959,7 +2956,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
clipboardStatus.removeListener(_onChangedClipboardStatus);
|
||||
clipboardStatus.dispose();
|
||||
_cursorVisibilityNotifier.dispose();
|
||||
_debugCursorNotifier.dispose();
|
||||
FocusManager.instance.removeListener(_unflagInternalFocus);
|
||||
super.dispose();
|
||||
assert(_batchEditDepth <= 0, 'unfinished batch edits: $_batchEditDepth');
|
||||
@ -3879,7 +3875,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
void _onCursorColorTick() {
|
||||
final double effectiveOpacity = math.min(widget.cursorColor.alpha / 255.0, _cursorBlinkOpacityController.value);
|
||||
renderEditable.cursorColor = widget.cursorColor.withOpacity(effectiveOpacity);
|
||||
_cursorVisibilityNotifier.value = widget.showCursor && _cursorBlinkOpacityController.value > 0;
|
||||
_cursorVisibilityNotifier.value = widget.showCursor && (EditableText.debugDeterministicCursor || _cursorBlinkOpacityController.value > 0);
|
||||
}
|
||||
|
||||
bool get _showBlinkingCursor => _hasFocus && _value.selection.isCollapsed && widget.showCursor && _tickersEnabled;
|
||||
@ -4860,9 +4856,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
value: _value,
|
||||
cursorColor: _cursorColor,
|
||||
backgroundCursorColor: widget.backgroundCursorColor,
|
||||
showCursor: EditableText.debugDeterministicCursor
|
||||
? _debugCursorNotifier
|
||||
: _cursorVisibilityNotifier,
|
||||
showCursor: _cursorVisibilityNotifier,
|
||||
forceLine: widget.forceLine,
|
||||
readOnly: widget.readOnly,
|
||||
hasFocus: _hasFocus,
|
||||
|
Loading…
x
Reference in New Issue
Block a user