_DropdownMenuState should dispose TextEditingController. (#133914)

This commit is contained in:
Polina Cherkasova 2023-09-06 08:12:10 -07:00 committed by GitHub
parent 03fcfbef21
commit 03b60ac75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -541,6 +541,9 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
@override
void dispose() {
if (widget.controller == null) {
_textEditingController.dispose();
}
super.dispose();
}

View File

@ -100,7 +100,7 @@ void main() {
expect(material.textStyle?.color, themeData.colorScheme.onSurface);
});
testWidgets('ThemeData.dropdownMenuTheme overrides defaults', (WidgetTester tester) async {
testWidgetsWithLeakTracking('ThemeData.dropdownMenuTheme overrides defaults', (WidgetTester tester) async {
final ThemeData theme = ThemeData(
dropdownMenuTheme: DropdownMenuThemeData(
textStyle: TextStyle(