Fix one notDisposed leak and mark another. (#133595)

This commit is contained in:
Polina Cherkasova 2023-08-29 16:08:48 -07:00 committed by GitHub
parent acaa97350a
commit 4736cd3d37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -1005,6 +1005,12 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
final ValueNotifier<EdgeInsets> _clipDetailsNotifier = ValueNotifier<EdgeInsets>(EdgeInsets.zero);
@override
void dispose() {
_clipDetailsNotifier.dispose();
super.dispose();
}
/// Updates the details regarding how the [SemanticsNode.rect] (focus) of
/// the barrier for this [ModalBottomSheetRoute] should be clipped.
///

View File

@ -7,6 +7,7 @@ import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import '../widgets/semantics_tester.dart';
@ -1672,7 +1673,8 @@ void main() {
});
group('Modal BottomSheet avoids overlapping display features', () {
testWidgets('positioning using anchorPoint', (WidgetTester tester) async {
testWidgetsWithLeakTracking('positioning using anchorPoint',
(WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
builder: (BuildContext context, Widget? child) {
@ -1708,7 +1710,12 @@ void main() {
// Should take the right side of the screen
expect(tester.getTopLeft(find.byType(Placeholder)).dx, 410);
expect(tester.getBottomRight(find.byType(Placeholder)).dx, 800);
});
},
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(polina-c): remove after fix
// https://github.com/flutter/flutter/issues/133594
notDisposedAllowList: <String, int?> {'ValueNotifier<EdgeInsets>': 1}
));
testWidgets('positioning using Directionality', (WidgetTester tester) async {
await tester.pumpWidget(