From c5d2104166d2d8b2632ef6800c0163f3fbae47eb Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Fri, 21 Nov 2025 02:01:49 +0200 Subject: [PATCH] =?UTF-8?q?Make=20sure=20that=20a=20TextSelectionToolbarTe?= =?UTF-8?q?xtButton=20doesn't=20crash=20in=200x0=20=E2=80=A6=20(#178374)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is my attempt to handle https://github.com/flutter/flutter/issues/6537 for the TextSelectionToolbarTextButton widget. Co-authored-by: Tong Mu Co-authored-by: Victor Sanni --- .../text_selection_toolbar_text_button_test.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart b/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart index ef321760f1f..fe8ee633284 100644 --- a/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart +++ b/packages/flutter/test/material/text_selection_toolbar_text_button_test.dart @@ -176,4 +176,19 @@ void main() { expect(textButton.style!.backgroundColor!.resolve({}), Colors.transparent); }); } + + testWidgets('TextSelectionToolbarTextButton does not crash at zero area', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + const MaterialApp( + home: Center( + child: SizedBox.shrink( + child: TextSelectionToolbarTextButton(padding: EdgeInsets.all(5), child: Text('X')), + ), + ), + ), + ); + expect(tester.getSize(find.byType(TextSelectionToolbarTextButton)), Size.zero); + }); }