Skip to content

Commit edc8a52

Browse files
Make sure that an Autocomplete doesn't crash in 0x0 environment (flutter#172732)
This is my attempt to handle flutter#6537 for the Autocomplete UI control. Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
1 parent 4703b78 commit edc8a52

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/flutter/test/material/autocomplete_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,25 @@ void main() {
731731
expect(field2.controller!.text, textSelection);
732732
});
733733

734+
testWidgets('Autocomplete renders at zero area', (WidgetTester tester) async {
735+
await tester.pumpWidget(
736+
MaterialApp(
737+
home: Center(
738+
child: SizedBox.shrink(
739+
child: Scaffold(
740+
body: Autocomplete<String>(
741+
initialValue: const TextEditingValue(text: 'X'),
742+
optionsBuilder: (TextEditingValue textEditingValue) => <String>['Y'],
743+
),
744+
),
745+
),
746+
),
747+
),
748+
);
749+
final Finder xText = find.text('X');
750+
expect(tester.getSize(xText), Size.zero);
751+
});
752+
734753
testWidgets('autocomplete options have button semantics', (WidgetTester tester) async {
735754
const Color highlightColor = Color(0xFF112233);
736755
await tester.pumpWidget(

0 commit comments

Comments
 (0)