From 2a88fa0f23fa66a33f6b5637007fa2ea803ffd28 Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Sat, 6 Dec 2025 01:45:03 +0200 Subject: [PATCH] Make sure that a CupertinoScrollbar doesn't crash in 0x0 environment (#179442) This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the CupertinoScrollbar widget. Co-authored-by: Tong Mu --- packages/flutter/test/cupertino/scrollbar_test.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/flutter/test/cupertino/scrollbar_test.dart b/packages/flutter/test/cupertino/scrollbar_test.dart index bec7944cecb..91ca7f42244 100644 --- a/packages/flutter/test/cupertino/scrollbar_test.dart +++ b/packages/flutter/test/cupertino/scrollbar_test.dart @@ -1347,4 +1347,15 @@ void main() { ), ); }); + + testWidgets('CupertinoScrollbar does not crash at zero area', (WidgetTester tester) async { + await tester.pumpWidget( + const CupertinoApp( + home: Center( + child: SizedBox.shrink(child: CupertinoScrollbar(child: CustomScrollView())), + ), + ), + ); + expect(tester.getSize(find.byType(CupertinoScrollbar)), Size.zero); + }); }