feat: inner-app dialog API support

This commit is contained in:
Michael Aaron Murphy 2024-03-27 16:01:35 +01:00 committed by Michael Murphy
parent 43b478ee68
commit 29f0489c8a
3 changed files with 23 additions and 2 deletions

View file

@ -136,13 +136,20 @@ impl<Message: 'static> Binder<Message> {
page.downcast_ref::<P>()
}
/// Obtain a reference to a page by its type ID.
/// Create a context drawer for the given page.
#[must_use]
pub fn context_drawer(&self, id: crate::Entity) -> Option<Element<'_, Message>> {
let page = self.page.get(id)?;
page.context_drawer()
}
/// Create a dialog for the given page.
#[must_use]
pub fn dialog(&self, id: crate::Entity) -> Option<Element<'_, Message>> {
let page = self.page.get(id)?;
page.dialog()
}
/// Obtain a reference to a page by its type ID.
#[must_use]
pub fn page_mut<P: Page<Message>>(&mut self) -> Option<&mut P> {