Skip to content

Commit 4736cd3

Browse files
authored
Fix one notDisposed leak and mark another. (flutter#133595)
1 parent acaa973 commit 4736cd3

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/flutter/lib/src/material/bottom_sheet.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,12 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
10051005

10061006
final ValueNotifier<EdgeInsets> _clipDetailsNotifier = ValueNotifier<EdgeInsets>(EdgeInsets.zero);
10071007

1008+
@override
1009+
void dispose() {
1010+
_clipDetailsNotifier.dispose();
1011+
super.dispose();
1012+
}
1013+
10081014
/// Updates the details regarding how the [SemanticsNode.rect] (focus) of
10091015
/// the barrier for this [ModalBottomSheetRoute] should be clipped.
10101016
///

packages/flutter/test/material/bottom_sheet_test.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'dart:ui';
77
import 'package:flutter/foundation.dart';
88
import 'package:flutter/material.dart';
99
import 'package:flutter_test/flutter_test.dart';
10+
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
1011

1112
import '../widgets/semantics_tester.dart';
1213

@@ -1672,7 +1673,8 @@ void main() {
16721673
});
16731674

16741675
group('Modal BottomSheet avoids overlapping display features', () {
1675-
testWidgets('positioning using anchorPoint', (WidgetTester tester) async {
1676+
testWidgetsWithLeakTracking('positioning using anchorPoint',
1677+
(WidgetTester tester) async {
16761678
await tester.pumpWidget(
16771679
MaterialApp(
16781680
builder: (BuildContext context, Widget? child) {
@@ -1708,7 +1710,12 @@ void main() {
17081710
// Should take the right side of the screen
17091711
expect(tester.getTopLeft(find.byType(Placeholder)).dx, 410);
17101712
expect(tester.getBottomRight(find.byType(Placeholder)).dx, 800);
1711-
});
1713+
},
1714+
leakTrackingTestConfig: const LeakTrackingTestConfig(
1715+
// TODO(polina-c): remove after fix
1716+
// https://github.com/flutter/flutter/issues/133594
1717+
notDisposedAllowList: <String, int?> {'ValueNotifier<EdgeInsets>': 1}
1718+
));
17121719

17131720
testWidgets('positioning using Directionality', (WidgetTester tester) async {
17141721
await tester.pumpWidget(

0 commit comments

Comments
 (0)