From edc8a52e80ffd5843e90f4aab92741591c9dd0ee Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Wed, 20 Aug 2025 23:58:35 +0300 Subject: [PATCH] Make sure that an Autocomplete doesn't crash in 0x0 environment (#172732) This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the Autocomplete UI control. Co-authored-by: Tong Mu --- .../test/material/autocomplete_test.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/flutter/test/material/autocomplete_test.dart b/packages/flutter/test/material/autocomplete_test.dart index d7776dc3405..6bae0829a66 100644 --- a/packages/flutter/test/material/autocomplete_test.dart +++ b/packages/flutter/test/material/autocomplete_test.dart @@ -731,6 +731,25 @@ void main() { expect(field2.controller!.text, textSelection); }); + testWidgets('Autocomplete renders at zero area', (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + home: Center( + child: SizedBox.shrink( + child: Scaffold( + body: Autocomplete( + initialValue: const TextEditingValue(text: 'X'), + optionsBuilder: (TextEditingValue textEditingValue) => ['Y'], + ), + ), + ), + ), + ), + ); + final Finder xText = find.text('X'); + expect(tester.getSize(xText), Size.zero); + }); + testWidgets('autocomplete options have button semantics', (WidgetTester tester) async { const Color highlightColor = Color(0xFF112233); await tester.pumpWidget(