Unverified Commit c9f70e9f authored by Polina Cherkasova's avatar Polina Cherkasova Committed by GitHub

_SearchBarState should dispose FocusNode, if it created it. (#133947)

parent 7cdf314d
......@@ -1179,6 +1179,9 @@ class _SearchBarState extends State<SearchBar> {
@override
void dispose() {
_internalStatesController.dispose();
if (widget.focusNode == null) {
_focusNode.dispose();
}
super.dispose();
}
......
......@@ -6,9 +6,10 @@ import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() {
testWidgets('SearchBar defaults', (WidgetTester tester) async {
testWidgetsWithLeakTracking('SearchBar defaults', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true);
final ColorScheme colorScheme = theme.colorScheme;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment