Make sure that a CupertinoPicker doesn't crash in 0x0 environment (#179258)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the CupertinoPicker
widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
This commit is contained in:
Ahmed Mohamed Sameh 2025-12-06 01:47:49 +02:00 committed by GitHub
parent 2300260b28
commit fe9a609404
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -831,4 +831,21 @@ void main() {
await tester.pump(tapScrollDuration + infinitesimalPause);
expect(selectedItem, equals(2));
});
testWidgets('CupertinoPicker does not crash at zero area', (WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: Center(
child: SizedBox.shrink(
child: CupertinoPicker(
itemExtent: 2.0,
onSelectedItemChanged: (_) {},
children: const <Widget>[Text('X'), Text('Y')],
),
),
),
),
);
expect(tester.getSize(find.byType(CupertinoPicker)), Size.zero);
});
}