SearchDelegate should dispose resources. (#133948)
This commit is contained in:
parent
2867b31f5e
commit
0d198c7ba6
@ -377,6 +377,15 @@ abstract class SearchDelegate<T> {
|
||||
}
|
||||
|
||||
_SearchPageRoute<T>? _route;
|
||||
|
||||
/// Releases the resources.
|
||||
@mustCallSuper
|
||||
void dispose() {
|
||||
_currentBodyNotifier.dispose();
|
||||
_focusNode?.dispose();
|
||||
_queryTextController.dispose();
|
||||
_proxyAnimation.parent = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes the body that is currently shown under the [AppBar] in the
|
||||
|
@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
|
||||
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 '../widgets/clipboard_utils.dart';
|
||||
import '../widgets/semantics_tester.dart';
|
||||
@ -25,8 +26,9 @@ void main() {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.platform, null);
|
||||
});
|
||||
|
||||
testWidgets('Changing query moves cursor to the end of query', (WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('Changing query moves cursor to the end of query', (WidgetTester tester) async {
|
||||
final _TestSearchDelegate delegate = _TestSearchDelegate();
|
||||
addTearDown(() => delegate.dispose());
|
||||
|
||||
await tester.pumpWidget(TestHomePage(delegate: delegate));
|
||||
await tester.tap(find.byTooltip('Search'));
|
||||
|
@ -22,9 +22,7 @@ Widget boilerplate({required Widget child}) {
|
||||
|
||||
void main() {
|
||||
|
||||
testWidgetsWithLeakTracking('SegmentedButton is built with Material of type MaterialType.transparency',
|
||||
leakTrackingTestConfig: LeakTrackingTestConfig.debugNotDisposed(),
|
||||
(WidgetTester tester) async {
|
||||
testWidgetsWithLeakTracking('SegmentedButton is built with Material of type MaterialType.transparency', (WidgetTester tester) async {
|
||||
final ThemeData theme = ThemeData(useMaterial3: true);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
|
Loading…
x
Reference in New Issue
Block a user