_SearchBarState should dispose FocusNode, if it created it. (#133947)
This commit is contained in:
parent
7cdf314d06
commit
c9f70e9fd2
@ -1179,6 +1179,9 @@ class _SearchBarState extends State<SearchBar> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_internalStatesController.dispose();
|
_internalStatesController.dispose();
|
||||||
|
if (widget.focusNode == null) {
|
||||||
|
_focusNode.dispose();
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@ import 'dart:ui';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('SearchBar defaults', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('SearchBar defaults', (WidgetTester tester) async {
|
||||||
final ThemeData theme = ThemeData(useMaterial3: true);
|
final ThemeData theme = ThemeData(useMaterial3: true);
|
||||||
final ColorScheme colorScheme = theme.colorScheme;
|
final ColorScheme colorScheme = theme.colorScheme;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user