Fix curved animation memory leak for scrollbar (#146670)
This commit is contained in:
parent
699749e43f
commit
e2c812155c
@ -1320,7 +1320,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
|
||||
ScrollController? _cachedController;
|
||||
Timer? _fadeoutTimer;
|
||||
late AnimationController _fadeoutAnimationController;
|
||||
late Animation<double> _fadeoutOpacityAnimation;
|
||||
late CurvedAnimation _fadeoutOpacityAnimation;
|
||||
final GlobalKey _scrollbarPainterKey = GlobalKey();
|
||||
bool _hoverIsActive = false;
|
||||
bool _thumbDragging = false;
|
||||
@ -2006,6 +2006,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
|
||||
_fadeoutAnimationController.dispose();
|
||||
_fadeoutTimer?.cancel();
|
||||
scrollbarPainter.dispose();
|
||||
_fadeoutOpacityAnimation.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
class _TestSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
|
||||
_TestSliverPersistentHeaderDelegate({
|
||||
@ -2054,7 +2055,10 @@ void main() {
|
||||
expect(tester.getTopLeft(find.text('Item 9')).dy, 226.0);
|
||||
});
|
||||
|
||||
testWidgets('allows overscrolling on default platforms - vertical', (WidgetTester tester) async {
|
||||
testWidgets('allows overscrolling on default platforms - vertical',
|
||||
// TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
|
||||
experimentalLeakTesting: LeakTesting.settings.withTracked(classes: const <String>['CurvedAnimation']),
|
||||
(WidgetTester tester) async {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/10949
|
||||
// Scrollables should overscroll by default on iOS and macOS
|
||||
final ScrollController controller = ScrollController();
|
||||
|
Loading…
x
Reference in New Issue
Block a user