pub struct OverlayPortalController { /* private fields */ }Expand description
A class to show, hide and bring to top an OverlayPortal’s overlay child in the target
Overlay.
An OverlayPortalController can only be given to at most one OverlayPortal at a
time. When an OverlayPortalController is moved from one OverlayPortal to another,
its is_showing state does not carry over.
show and hide can be called even before the controller is
assigned to any OverlayPortal, but they typically should not be called while the
widget tree is being rebuilt.
Implementations§
Source§impl OverlayPortalController
impl OverlayPortalController
Sourcepub fn new(
app: &mut App,
debug_label: Option<String>,
) -> Ref<OverlayPortalController>
pub fn new( app: &mut App, debug_label: Option<String>, ) -> Ref<OverlayPortalController>
Creates an OverlayPortalController, optionally with a debug_label.
Sourcepub fn show(self: Handle<Self>, app: &mut App)
pub fn show(self: Handle<Self>, app: &mut App)
Show the overlay child of the OverlayPortal this controller is attached to, at the
top of the target Overlay.
When there is more than one OverlayPortal that targets the same Overlay, the
overlay child of the last OverlayPortal to have called
show appears at the top level, unobstructed.
If is_showing is already true, calling this method brings the
overlay child it controls to the top.
This method should typically not be called while the widget tree is being rebuilt.
Sourcepub fn hide(self: Handle<Self>, app: &mut App)
pub fn hide(self: Handle<Self>, app: &mut App)
Hide the OverlayPortal’s overlay child.
Once hidden, the overlay child will be removed from the widget tree the next time the widget tree rebuilds, and stateful widgets in the overlay child may lose state as a result.
This method should typically not be called while the widget tree is being rebuilt.
Sourcepub fn is_showing(self: Handle<Self>, app: &App) -> bool
pub fn is_showing(self: Handle<Self>, app: &App) -> bool
Whether the associated OverlayPortal should build and show its overlay child,
using its overlay_child_builder.
Sourcepub fn toggle(self: Handle<Self>, app: &mut App)
pub fn toggle(self: Handle<Self>, app: &mut App)
Convenience method for toggling the current is_showing status.
This method should typically not be called while the widget tree is being rebuilt.