pub struct OverlayRequest {
pub content_id: WidgetId,
pub anchor: WidgetId,
pub placement: OverlayPlacement,
pub dismiss: DismissBehavior,
pub layer: OverlayLayer,
pub parent_overlay: Option<OverlayId>,
pub on_dismiss: Option<OverlayDismissCallback>,
pub fade_duration: Option<Duration>,
}Expand description
A request to show an overlay.
Fields§
§content_id: WidgetIdThe root widget of the overlay content.
anchor: WidgetIdThe widget this overlay is anchored to.
placement: OverlayPlacementPositioning relative to the anchor.
dismiss: DismissBehaviorHow the overlay is dismissed.
layer: OverlayLayerRendering layer.
parent_overlay: Option<OverlayId>Parent overlay (for submenu cascading).
on_dismiss: Option<OverlayDismissCallback>Invoked when the overlay is dismissed by any path. Use this
to reset anchor-side state (e.g. ComboBox.interaction)
when the framework tears down the overlay without going
through the anchor’s own key/tap handlers.
fade_duration: Option<Duration>Optional fade-in / fade-out duration. When Some, the
framework attaches an animated opacity scope to content_id
at show time (using the existing set_opacity rendering
pipeline — no Fade widget required from the caller), tweens
the opacity from 0 → 1 over duration, and on dismiss
reverses the tween and defers the actual stack removal by
duration. Construct with OverlayRequest::with_fade when
the struct-literal idiom isn’t ergonomic.
Implementations§
Source§impl OverlayRequest
impl OverlayRequest
Sourcepub fn with_fade(self, duration: Duration) -> Self
pub fn with_fade(self, duration: Duration) -> Self
Attach a fade-in / fade-out animation to this request.
duration controls both directions. The framework wires
everything internally — caller does not create a Fade
widget or manage a signal:
let req = OverlayRequest { content_id, anchor, ... }
.with_fade(theme.motion.duration_fast);