From 1126dc37934001f32ee8a650566eb419bbd2a3e2 Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Thu, 9 Oct 2025 03:16:54 +0300 Subject: [PATCH] Make sure that a FloatingActionButton doesn't crash in 0x0 environment (#175272) This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the FloatingActionButton widget. --- .../test/material/floating_action_button_test.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart index 02697927d87..1e7b7deae80 100644 --- a/packages/flutter/test/material/floating_action_button_test.dart +++ b/packages/flutter/test/material/floating_action_button_test.dart @@ -1467,6 +1467,19 @@ void main() { }, ); }); + + testWidgets('FloatingActionButton does not crash at zero area', (WidgetTester tester) async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + floatingActionButton: Center( + child: SizedBox.shrink(child: FloatingActionButton(onPressed: () {})), + ), + ), + ), + ); + expect(tester.getSize(find.byType(FloatingActionButton)), Size.zero); + }); } Offset _rightEdgeOfFab(WidgetTester tester) {