diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index d3e8663271..264ca6665b 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -2125,7 +2125,6 @@ class EditableTextState extends State with AutomaticKeepAliveClien late final Simulation _iosBlinkCursorSimulation = _DiscreteKeyFrameSimulation.iOSBlinkingCaret(); final ValueNotifier _cursorVisibilityNotifier = ValueNotifier(true); - final ValueNotifier _debugCursorNotifier = ValueNotifier(true); final GlobalKey _editableKey = GlobalKey(); /// Detects whether the clipboard can paste. @@ -2803,8 +2802,6 @@ class EditableTextState extends State 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 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 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 with AutomaticKeepAliveClien value: _value, cursorColor: _cursorColor, backgroundCursorColor: widget.backgroundCursorColor, - showCursor: EditableText.debugDeterministicCursor - ? _debugCursorNotifier - : _cursorVisibilityNotifier, + showCursor: _cursorVisibilityNotifier, forceLine: widget.forceLine, readOnly: widget.readOnly, hasFocus: _hasFocus,