mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix _RenderValueIndicator leak (#147451)
This commit is contained in:
parent
f9933b6994
commit
1189d44240
@ -1868,7 +1868,7 @@ class _RenderValueIndicator extends RenderBox with RelayoutWhenSystemFontsChange
|
||||
curve: Curves.fastOutSlowIn,
|
||||
);
|
||||
}
|
||||
late Animation<double> _valueIndicatorAnimation;
|
||||
late CurvedAnimation _valueIndicatorAnimation;
|
||||
_SliderState _state;
|
||||
|
||||
@override
|
||||
@ -1897,6 +1897,12 @@ class _RenderValueIndicator extends RenderBox with RelayoutWhenSystemFontsChange
|
||||
Size computeDryLayout(BoxConstraints constraints) {
|
||||
return constraints.smallest;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_valueIndicatorAnimation.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class _SliderDefaultsM2 extends SliderThemeData {
|
||||
|
||||
@ -13,6 +13,7 @@ import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/src/physics/utils.dart' show nearEqual;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
import '../widgets/semantics_tester.dart';
|
||||
|
||||
@ -140,7 +141,10 @@ void main() {
|
||||
expect(log[0], const Offset(212.0, 300.0));
|
||||
});
|
||||
|
||||
testWidgets('Slider can move when tapped (LTR)', (WidgetTester tester) async {
|
||||
testWidgets(
|
||||
// TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
|
||||
experimentalLeakTesting: LeakTesting.settings.withTracked(classes: <String>['CurvedAnimation']),
|
||||
'Slider can move when tapped (LTR)', (WidgetTester tester) async {
|
||||
final Key sliderKey = UniqueKey();
|
||||
double value = 0.0;
|
||||
double? startValue;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user