resolvePlacement method
- required Rect anchorRect,
- required Size overlaySize,
- required EdgeInsets mediaPadding,
Resolves the final menu placement for the current overlay and anchor.
When placement is AnchoredPopupMenuPlacement.auto, the menu is placed on the side with more available vertical space.
Implementation
AnchoredPopupMenuPlacement resolvePlacement({
required Rect anchorRect,
required Size overlaySize,
required EdgeInsets mediaPadding,
}) {
return switch (placement) {
.above => .above,
.below => .below,
.auto =>
_availableHeightAbove(
anchorRect: anchorRect,
mediaPadding: mediaPadding,
) >=
_availableHeightBelow(
anchorRect: anchorRect,
overlaySize: overlaySize,
mediaPadding: mediaPadding,
)
? .above
: .below,
};
}