Skip to content

Commit

Permalink
fixes RawDialogRoute memory leak (#147817)
Browse files Browse the repository at this point in the history
part of #141198 

- Fixes memory leak on `RawDialogRoute`
- Adds opt-in test
  • Loading branch information
Dimilkalathiya committed May 7, 2024
1 parent 1fee187 commit 4abd735
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/flutter/lib/src/widgets/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2286,10 +2286,7 @@ class RawDialogRoute<T> extends PopupRoute<T> {
if (_transitionBuilder == null) {
// Some default transition.
return FadeTransition(
opacity: CurvedAnimation(
parent: animation,
curve: Curves.linear,
),
opacity: animation,
child: child,
);
}
Expand Down
6 changes: 5 additions & 1 deletion packages/flutter/test/widgets/routes_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';

import 'semantics_tester.dart';

Expand Down Expand Up @@ -974,7 +975,10 @@ void main() {
expect(secondaryAnimationOfRouteOne.value, primaryAnimationOfRouteTwo.value);
});

testWidgets('showGeneralDialog handles transparent barrier color', (WidgetTester tester) async {
testWidgets('showGeneralDialog handles transparent barrier color',
// 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: Builder(
builder: (BuildContext context) {
Expand Down

0 comments on commit 4abd735

Please sign in to comment.