_SearchBarState should dispose FocusNode, if it created it. (#134076)
Relanding of revert: https://github.com/flutter/flutter/pull/134072 Verified failed tests succeeded now:
This commit is contained in:
parent
5a8a20c63e
commit
1c0b4ad53a
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user