From 5266539cfbbbdc3aa2336816bf8af1df18344a57 Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Wed, 10 Dec 2025 02:26:59 +0200 Subject: [PATCH] Make sure that a CupertinoListSection doesn't crash in 0x0 environment (#179068) This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the CupertinoListSection widget. Co-authored-by: Tong Mu Co-authored-by: Victor Sanni --- .../flutter/test/cupertino/list_section_test.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/flutter/test/cupertino/list_section_test.dart b/packages/flutter/test/cupertino/list_section_test.dart index 78426709fd2..3539e0eea60 100644 --- a/packages/flutter/test/cupertino/list_section_test.dart +++ b/packages/flutter/test/cupertino/list_section_test.dart @@ -258,4 +258,15 @@ void main() { offsetMoreOrLessEquals(const Offset(margin, 41 + margin), epsilon: 1), ); }); + + testWidgets('CupertinoListSection does not crash at zero area', (WidgetTester tester) async { + await tester.pumpWidget( + const CupertinoApp( + home: Center( + child: SizedBox.shrink(child: CupertinoListSection(header: Text('X'))), + ), + ), + ); + expect(tester.getSize(find.byType(CupertinoListSection)), Size.zero); + }); }