mirror of
https://github.com/flutter/flutter
synced 2024-08-24 18:36:03 +00:00
Fix leaking curved animation. (#146644)
This commit is contained in:
parent
000101a369
commit
5ebc94082e
|
@ -1140,9 +1140,9 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||
double get _minPreferredTrackHeight => _sliderTheme.trackHeight!;
|
||||
|
||||
final _SliderState _state;
|
||||
late Animation<double> _overlayAnimation;
|
||||
late Animation<double> _valueIndicatorAnimation;
|
||||
late Animation<double> _enableAnimation;
|
||||
late CurvedAnimation _overlayAnimation;
|
||||
late CurvedAnimation _valueIndicatorAnimation;
|
||||
late CurvedAnimation _enableAnimation;
|
||||
final TextPainter _labelPainter = TextPainter();
|
||||
late HorizontalDragGestureRecognizer _drag;
|
||||
late TapGestureRecognizer _tap;
|
||||
|
@ -1451,6 +1451,9 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
|||
_drag.dispose();
|
||||
_tap.dispose();
|
||||
_labelPainter.dispose();
|
||||
_enableAnimation.dispose();
|
||||
_valueIndicatorAnimation.dispose();
|
||||
_overlayAnimation.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
Future<void> verifyMarkedNeedsLayoutDuringTransientCallbacksPhase(WidgetTester tester, RenderObject renderObject) async {
|
||||
assert(!renderObject.debugNeedsLayout);
|
||||
|
@ -189,7 +190,7 @@ void main() {
|
|||
expect(element.dirty, isTrue);
|
||||
}, skip: isBrowser); // TODO(yjbanov): cupertino does not work on the Web yet: https://github.com/flutter/flutter/issues/41920
|
||||
|
||||
testWidgets('RangeSlider relayout upon system fonts changes', (WidgetTester tester) async {
|
||||
testWidgets('RangeSlider relayout upon system fonts changes more than once', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Material(
|
||||
|
@ -212,7 +213,10 @@ void main() {
|
|||
await verifyMarkedNeedsLayoutDuringTransientCallbacksPhase(tester, renderObject);
|
||||
});
|
||||
|
||||
testWidgets('Slider relayout upon system fonts changes', (WidgetTester tester) async {
|
||||
testWidgets('Slider relayout upon system fonts changes',
|
||||
// TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
|
||||
experimentalLeakTesting: LeakTesting.settings.withTracked(classes: <String>['CurvedAnimation']),
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Material(
|
||||
|
|
Loading…
Reference in a new issue