From fe9a609404a14d6f3ff16bfee8d795486ffa106c Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Sat, 6 Dec 2025 01:47:49 +0200 Subject: [PATCH] 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 --- .../flutter/test/cupertino/picker_test.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/flutter/test/cupertino/picker_test.dart b/packages/flutter/test/cupertino/picker_test.dart index a89fe6174de..b6475a6c351 100644 --- a/packages/flutter/test/cupertino/picker_test.dart +++ b/packages/flutter/test/cupertino/picker_test.dart @@ -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 [Text('X'), Text('Y')], + ), + ), + ), + ), + ); + expect(tester.getSize(find.byType(CupertinoPicker)), Size.zero); + }); }