Skip to content

Conversation

@ahmedsameha1
Copy link
Contributor

This is my attempt to handle #6537 for the MenuAnchor widget.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Sep 30, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new widget test for MenuAnchor to ensure it does not crash when placed in a zero-sized environment, such as a SizedBox.shrink. The test verifies that the MenuAnchor widget correctly handles being laid out with zero area by asserting its size is Size.zero.

@dkwingsmt dkwingsmt self-requested a review October 1, 2025 18:26
@dkwingsmt
Copy link
Contributor

Since MenuAnchor contains an overlay, can you use the same approach as DropdownMenu and set the view size?

@ahmedsameha1 ahmedsameha1 force-pushed the handle#6537-MenuAnchor branch from 0ca9be5 to efbb457 Compare October 19, 2025 18:28
Copy link
Contributor

@dkwingsmt dkwingsmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

(I don't know why the unit tests keep failing. They don't fail on my computer. Let me retry them again.)

@dkwingsmt dkwingsmt requested a review from victorsanni October 20, 2025 21:04
@ahmedsameha1 ahmedsameha1 force-pushed the handle#6537-MenuAnchor branch from 2c913fa to 0a30f06 Compare October 20, 2025 22:01
});

testWidgets('MenuAnchor does not crash at zero area', (WidgetTester tester) async {
final Size temp = tester.view.physicalSize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating a new local variable, you can just add this one-liner instead:

addTearDown(tester.view.reset);

@dkwingsmt
Copy link
Contributor

Ohhhh right, we haven't reverted the view size after setting it.

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 2, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Nov 2, 2025
Merged via the queue into flutter:master with commit 285e6f0 Nov 2, 2025
77 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…#176302)

This is my attempt to handle
flutter#6537 for the MenuAnchor
widget.

---------

Co-authored-by: Tong Mu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants