File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -1096,7 +1096,7 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
10961096 @override
10971097 Duration get transitionDuration => _kModalPopupTransitionDuration;
10981098
1099- Animation < double > ? _animation;
1099+ CurvedAnimation ? _animation;
11001100
11011101 late Tween <Offset > _offsetTween;
11021102
@@ -1142,6 +1142,12 @@ class CupertinoModalPopupRoute<T> extends PopupRoute<T> {
11421142 ),
11431143 );
11441144 }
1145+
1146+ @override
1147+ void dispose () {
1148+ _animation? .dispose ();
1149+ super .dispose ();
1150+ }
11451151}
11461152
11471153/// Shows a modal iOS-style popup that slides up from the bottom of the screen.
Original file line number Diff line number Diff line change @@ -2666,6 +2666,36 @@ void main() {
26662666
26672667 await tester.pump (const Duration (milliseconds: 400 ));
26682668 });
2669+
2670+ testWidgets ('CupertinoModalPopupRoute does not leak CurveAnimation' ,
2671+ // TODO(polina-c): remove when fixed https://github.com/flutter/flutter/issues/145600 [leak-tracking-opt-in]
2672+ experimentalLeakTesting: LeakTesting .settings.withTracked (classes: < String > ['CurvedAnimation' ]),
2673+ (WidgetTester tester) async {
2674+ await tester.pumpWidget (MaterialApp (
2675+ home: Navigator (
2676+ onGenerateRoute: (RouteSettings settings) {
2677+ return PageRouteBuilder <dynamic >(
2678+ pageBuilder: (BuildContext context, Animation <double > _, Animation <double > __) {
2679+ return GestureDetector (
2680+ onTap: () async {
2681+ await showCupertinoModalPopup <void >(
2682+ context: context,
2683+ semanticsDismissible: true ,
2684+ builder: (BuildContext context) => const SizedBox (),
2685+ );
2686+ },
2687+ child: const Text ('tap' ),
2688+ );
2689+ },
2690+ );
2691+ },
2692+ ),
2693+ ));
2694+
2695+ // Push the route.
2696+ await tester.tap (find.text ('tap' ));
2697+ await tester.pumpAndSettle ();
2698+ });
26692699}
26702700
26712701class MockNavigatorObserver extends NavigatorObserver {
You can’t perform that action at this time.
0 commit comments