Make sure that a LongPressDraggable doesn't crash in 0x0 environment#180408
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a test to ensure LongPressDraggable doesn't crash in a zero-size environment. The test correctly sets up the scenario with a zero-sized widget. However, it misses simulating the long press gesture, which is the actual trigger for the crash described in the associated issue. I've added suggestions to complete the test by adding the long press action and also to improve code style by using const constructors.
| ), | ||
| ), | ||
| ); | ||
| expect(tester.getSize(find.byType(LongPressDraggable<bool>)), Size.zero); |
There was a problem hiding this comment.
This test is intended to verify that LongPressDraggable doesn't crash in a zero-sized environment, as per the issue description. However, it only checks that the widget can be created with a zero size. It doesn't simulate a long press, which is the action that would trigger the crash.
To properly test the fix, you should simulate a long press gesture on the widget.
expect(tester.getSize(find.byType(LongPressDraggable<bool>)), Size.zero);
// This should not crash.
await tester.longPress(find.byType(LongPressDraggable<bool>));
await tester.pump();| feedback: Text('Y'), | ||
| child: Text('X'), |
There was a problem hiding this comment.
| feedback: Text('Y'), | ||
| child: Text('X'), |
dkwingsmt
left a comment
There was a problem hiding this comment.
Since an overlay is involved, I think we should set the viewport size instead.
flutter/flutter@3134be8...d81cd3e 2026-01-12 [email protected] Migrate doc and code to use sendAnnounce (flutter/flutter#180776) 2026-01-12 [email protected] Roll Packages from 51fe1d9 to e57e7f4 (3 revisions) (flutter/flutter#180846) 2026-01-12 [email protected] Fix: Allow dartpad embed clipboard-write permission for "Copy to clipboard" functionality (flutter/flutter#178057) 2026-01-12 [email protected] Roll Dart SDK from 87fbfd5381b6 to 42fd9ef68c1a (1 revision) (flutter/flutter#180836) 2026-01-12 [email protected] Roll Skia from aefdde600f1e to 487a9943210b (3 revisions) (flutter/flutter#180835) 2026-01-12 [email protected] Bump ffigen (flutter/flutter#180507) 2026-01-12 [email protected] Roll Skia from d42a43daa6cf to aefdde600f1e (1 revision) (flutter/flutter#180829) 2026-01-12 [email protected] Make sure that a LongPressDraggable doesn't crash in 0x0 environment (flutter/flutter#180408) 2026-01-12 [email protected] Make sure that a FlutterLogo doesn't crash in 0x0 environment (flutter/flutter#180617) 2026-01-12 [email protected] Roll Fuchsia Linux SDK from T_HOCpDjLgzi1SUMq... to VYeyMPe1lyCtlcl-V... (flutter/flutter#180825) 2026-01-11 [email protected] Roll Skia from f39cc645b1dd to d42a43daa6cf (2 revisions) (flutter/flutter#180819) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/flutter@3134be8...d81cd3e 2026-01-12 [email protected] Migrate doc and code to use sendAnnounce (flutter/flutter#180776) 2026-01-12 [email protected] Roll Packages from 51fe1d9 to e57e7f4 (3 revisions) (flutter/flutter#180846) 2026-01-12 [email protected] Fix: Allow dartpad embed clipboard-write permission for "Copy to clipboard" functionality (flutter/flutter#178057) 2026-01-12 [email protected] Roll Dart SDK from 87fbfd5381b6 to 42fd9ef68c1a (1 revision) (flutter/flutter#180836) 2026-01-12 [email protected] Roll Skia from aefdde600f1e to 487a9943210b (3 revisions) (flutter/flutter#180835) 2026-01-12 [email protected] Bump ffigen (flutter/flutter#180507) 2026-01-12 [email protected] Roll Skia from d42a43daa6cf to aefdde600f1e (1 revision) (flutter/flutter#180829) 2026-01-12 [email protected] Make sure that a LongPressDraggable doesn't crash in 0x0 environment (flutter/flutter#180408) 2026-01-12 [email protected] Make sure that a FlutterLogo doesn't crash in 0x0 environment (flutter/flutter#180617) 2026-01-12 [email protected] Roll Fuchsia Linux SDK from T_HOCpDjLgzi1SUMq... to VYeyMPe1lyCtlcl-V... (flutter/flutter#180825) 2026-01-11 [email protected] Roll Skia from f39cc645b1dd to d42a43daa6cf (2 revisions) (flutter/flutter#180819) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/flutter@3134be8...d81cd3e 2026-01-12 [email protected] Migrate doc and code to use sendAnnounce (flutter/flutter#180776) 2026-01-12 [email protected] Roll Packages from 51fe1d9 to e57e7f4 (3 revisions) (flutter/flutter#180846) 2026-01-12 [email protected] Fix: Allow dartpad embed clipboard-write permission for "Copy to clipboard" functionality (flutter/flutter#178057) 2026-01-12 [email protected] Roll Dart SDK from 87fbfd5381b6 to 42fd9ef68c1a (1 revision) (flutter/flutter#180836) 2026-01-12 [email protected] Roll Skia from aefdde600f1e to 487a9943210b (3 revisions) (flutter/flutter#180835) 2026-01-12 [email protected] Bump ffigen (flutter/flutter#180507) 2026-01-12 [email protected] Roll Skia from d42a43daa6cf to aefdde600f1e (1 revision) (flutter/flutter#180829) 2026-01-12 [email protected] Make sure that a LongPressDraggable doesn't crash in 0x0 environment (flutter/flutter#180408) 2026-01-12 [email protected] Make sure that a FlutterLogo doesn't crash in 0x0 environment (flutter/flutter#180617) 2026-01-12 [email protected] Roll Fuchsia Linux SDK from T_HOCpDjLgzi1SUMq... to VYeyMPe1lyCtlcl-V... (flutter/flutter#180825) 2026-01-11 [email protected] Roll Skia from f39cc645b1dd to d42a43daa6cf (2 revisions) (flutter/flutter#180819) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is my attempt to handle #6537 for the LongPressDraggable widget.