From a9be1dfab3a3ca0e31190a9ec23c2e96fdd64ff1 Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Sat, 9 Aug 2025 00:08:06 +0300 Subject: [PATCH] Make sure that a Checkbox doesn't crash in 0x0 environment (#173178) This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the Checkbox UI control. --- packages/flutter/test/material/checkbox_test.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/flutter/test/material/checkbox_test.dart b/packages/flutter/test/material/checkbox_test.dart index 01a9516be66..549abbcfd63 100644 --- a/packages/flutter/test/material/checkbox_test.dart +++ b/packages/flutter/test/material/checkbox_test.dart @@ -2476,6 +2476,17 @@ void main() { ); expect(getCheckboxRenderer(), paints..path(color: inactiveBackgroundColor)); }); + + testWidgets('Checkbox renders at zero area', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: Center( + child: SizedBox.shrink(child: Scaffold(body: Checkbox(value: true, onChanged: null))), + ), + ), + ); + expect(tester.takeException(), isNull); + }); } class _SelectedGrabMouseCursor extends MaterialStateMouseCursor {