Unverified Commit 2d9a075d authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

Cover text_selection tests with leak tracking. (#137009)

parent db57d286
...@@ -364,7 +364,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, ...@@ -364,7 +364,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
_readOnly = readOnly, _readOnly = readOnly,
_forceLine = forceLine, _forceLine = forceLine,
_clipBehavior = clipBehavior, _clipBehavior = clipBehavior,
_hasFocus = hasFocus ?? false { _hasFocus = hasFocus ?? false,
_disposeShowCursor = showCursor == null {
assert(!_showCursor.value || cursorColor != null); assert(!_showCursor.value || cursorColor != null);
_selectionPainter.highlightColor = selectionColor; _selectionPainter.highlightColor = selectionColor;
...@@ -405,6 +406,10 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, ...@@ -405,6 +406,10 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
_selectionPainter.dispose(); _selectionPainter.dispose();
_caretPainter.dispose(); _caretPainter.dispose();
_textPainter.dispose(); _textPainter.dispose();
if (_disposeShowCursor) {
_showCursor.dispose();
_disposeShowCursor = false;
}
super.dispose(); super.dispose();
} }
...@@ -879,6 +884,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, ...@@ -879,6 +884,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
_caretPainter.backgroundCursorColor = value; _caretPainter.backgroundCursorColor = value;
} }
bool _disposeShowCursor;
/// Whether to paint the cursor. /// Whether to paint the cursor.
ValueNotifier<bool> get showCursor => _showCursor; ValueNotifier<bool> get showCursor => _showCursor;
ValueNotifier<bool> _showCursor; ValueNotifier<bool> _showCursor;
...@@ -889,6 +896,10 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin, ...@@ -889,6 +896,10 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin,
if (attached) { if (attached) {
_showCursor.removeListener(_showHideCursor); _showCursor.removeListener(_showHideCursor);
} }
if (_disposeShowCursor) {
_showCursor.dispose();
_disposeShowCursor = false;
}
_showCursor = value; _showCursor = value;
if (attached) { if (attached) {
_showHideCursor(); _showHideCursor();
......
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() { void main() {
testWidgets('positions itself at anchorAbove if it fits', (WidgetTester tester) async { testWidgetsWithLeakTracking('positions itself at anchorAbove if it fits', (WidgetTester tester) async {
late StateSetter setState; late StateSetter setState;
const double height = 43.0; const double height = 43.0;
const double anchorBelowY = 500.0; const double anchorBelowY = 500.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment