From 3d3e2ebc51f4576e7fd2bd857364805ca6a94f4e Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Sameh Date: Tue, 21 Oct 2025 01:45:08 +0300 Subject: [PATCH] =?UTF-8?q?Make=20sure=20that=20a=20CupertinoDesktopTextSe?= =?UTF-8?q?lectionToolbar=20doesn't=20crash=20i=E2=80=A6=20(#173964)?= 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 CupertinoDesktopTextSelectionToolbar UI control. --------- Co-authored-by: Tong Mu --- .../desktop_text_selection_toolbar_test.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/flutter/test/cupertino/desktop_text_selection_toolbar_test.dart b/packages/flutter/test/cupertino/desktop_text_selection_toolbar_test.dart index d38083400fe..1600ac8ad4f 100644 --- a/packages/flutter/test/cupertino/desktop_text_selection_toolbar_test.dart +++ b/packages/flutter/test/cupertino/desktop_text_selection_toolbar_test.dart @@ -127,4 +127,22 @@ void main() { greaterThan(anchor), ); }); + + testWidgets('CupertinoDesktopTextSelectionToolbar does not crash at zero area', ( + WidgetTester tester, + ) async { + await tester.pumpWidget( + CupertinoApp( + home: Center( + child: SizedBox.shrink( + child: CupertinoDesktopTextSelectionToolbar( + anchor: const Offset(10, 10), + children: const [Text('X')], + ), + ), + ), + ), + ); + expect(tester.getSize(find.byType(CupertinoDesktopTextSelectionToolbar)), Size.zero); + }); }