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 <dkwingsmt@users.noreply.github.com>
This commit is contained in:
Ahmed Mohamed Sameh 2025-08-20 23:58:35 +03:00 committed by GitHub
parent 4703b786e6
commit edc8a52e80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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<String>(
initialValue: const TextEditingValue(text: 'X'),
optionsBuilder: (TextEditingValue textEditingValue) => <String>['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(