From a8577f996b67fedbfe76b9ca8059ea0554db15e7 Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Sat, 6 Dec 2025 01:46:25 +0200 Subject: [PATCH] Make sure that CupertinoNavigationBar doesn't crash in 0x0 environment (#179235) This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the CupertinoNavigationBar widget. Co-authored-by: Tong Mu --- packages/flutter/test/cupertino/nav_bar_test.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/flutter/test/cupertino/nav_bar_test.dart b/packages/flutter/test/cupertino/nav_bar_test.dart index cd0fae6d29b..a38457b921a 100644 --- a/packages/flutter/test/cupertino/nav_bar_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_test.dart @@ -3329,6 +3329,15 @@ void main() { expect(find.text('First'), findsNothing); expect(find.text('Second'), findsOneWidget); }); + + testWidgets('CupertinoNavigationBar does not crash at zero area', (WidgetTester tester) async { + await tester.pumpWidget( + const CupertinoApp( + home: Center(child: SizedBox.shrink(child: CupertinoNavigationBar())), + ), + ); + expect(tester.getSize(find.byType(CupertinoNavigationBar)), Size.zero); + }); } class _ExpectStyles extends StatelessWidget {