Skip to content

Pipe through View's MediaQueryData to OverlayPortal children#170818

Closed
Piinks wants to merge 1 commit into
flutter:masterfrom
Piinks:overlayFix
Closed

Pipe through View's MediaQueryData to OverlayPortal children#170818
Piinks wants to merge 1 commit into
flutter:masterfrom
Piinks:overlayFix

Conversation

@Piinks

@Piinks Piinks commented Jun 18, 2025

Copy link
Copy Markdown
Contributor

Part of #142921
Not sure on this approach, this is a new neighborhood for me. :)

Follow up to resolve #142921 will be to incorporate the MediaQueryData into the positioning in _MenuLayout.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@Piinks Piinks requested a review from LongCatIsLooong June 18, 2025 17:09
@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Jun 18, 2025
// over the widget tree, may not be aware of obstructions like the software
// keyboard. This provides the accurate MediaQueryData for the View to the
// Overlay.
return MediaQuery.fromView(view: View.of(context), child: portal);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should be getting the MediaQueryData from the Overlay's BuildContext, not the View, since the overlay child will be shown on the Overlay.

OverlayPortal has 2 children. Only the overlay child should see the MediaQueryData from the Overlay, the other child (the regular child) should see the same MediaQueryData as its parent.

Also I think we should only copyWith the padding / viewInset (and whatever is relevant in MediaQueryData). Things like accessibility settings should still be from the parent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OverlayPortal has 2 children. Only the overlay child should see the MediaQueryData from the Overlay, the other child (the regular child) should see the same MediaQueryData as its parent.

This part I am not sure I follow, which child is which?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here's what I think..

Only the overlay child should see the MediaQueryData from the Overlay,

I think this means overlayChildBuilder

the other child (the regular child) should see the same MediaQueryData as its parent.

I think this means child

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah overlayChildBuilder builds the child that will be shown in the Overlay (as if it was in an OverlayEntry) while child is just like any other Widget.child

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gotcha gotcha! Thanks!

@Piinks

Piinks commented Jun 18, 2025

Copy link
Copy Markdown
Contributor Author

Ah that makes a lot of sense! Thanks! I will update.

@Piinks

Piinks commented Jul 17, 2025

Copy link
Copy Markdown
Contributor Author

Closing to open a fresh PR since it's been a while.

@Piinks Piinks closed this Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

menuChildren by MenuAnchor gets hidden behind mobile keyboard

2 participants