pub struct MaterialDrawer<'a> { /* private fields */ }Expand description
Material Design navigation drawer component.
Navigation drawers provide access to destinations and app functionality. They can be permanently on-screen or controlled by navigation triggers.
let mut drawer_open = true;
let drawer = MaterialDrawer::new(DrawerVariant::Permanent, &mut drawer_open)
.header("Mail", Some("email@material.io"))
.item("Inbox", Some("inbox"), true)
.item("Sent", Some("send"), false)
.item("Drafts", Some("drafts"), false);
drawer.show(ui.ctx());Implementations§
Source§impl<'a> MaterialDrawer<'a>
impl<'a> MaterialDrawer<'a>
Sourcepub fn new(variant: DrawerVariant, open: &'a mut bool) -> Self
pub fn new(variant: DrawerVariant, open: &'a mut bool) -> Self
Create a new navigation drawer with Material 3 defaults.
Sourcepub fn new_with_id(variant: DrawerVariant, open: &'a mut bool, id: Id) -> Self
pub fn new_with_id(variant: DrawerVariant, open: &'a mut bool, id: Id) -> Self
Create a new navigation drawer with custom ID.
Sourcepub fn alignment(self, alignment: DrawerAlignment) -> Self
pub fn alignment(self, alignment: DrawerAlignment) -> Self
Set drawer alignment (start or end).
Sourcepub fn theme(self, theme: DrawerThemeData) -> Self
pub fn theme(self, theme: DrawerThemeData) -> Self
Set drawer theme.
Sourcepub fn enable_drag_gesture(self, enable: bool) -> Self
pub fn enable_drag_gesture(self, enable: bool) -> Self
Enable or disable drag gestures.
Sourcepub fn edge_drag_width(self, width: f32) -> Self
pub fn edge_drag_width(self, width: f32) -> Self
Set the edge drag width for opening the drawer.
Sourcepub fn barrier_dismissible(self, dismissible: bool) -> Self
pub fn barrier_dismissible(self, dismissible: bool) -> Self
Set whether tapping the barrier dismisses the drawer.
Sourcepub fn semantic_label(self, label: impl Into<String>) -> Self
pub fn semantic_label(self, label: impl Into<String>) -> Self
Set semantic label for accessibility.
Sourcepub fn header(
self,
title: impl Into<String>,
subtitle: Option<impl Into<String>>,
) -> Self
pub fn header( self, title: impl Into<String>, subtitle: Option<impl Into<String>>, ) -> Self
Add header with title and optional subtitle.
Sourcepub fn item(
self,
text: impl Into<String>,
icon: Option<impl Into<String>>,
active: bool,
) -> Self
pub fn item( self, text: impl Into<String>, icon: Option<impl Into<String>>, active: bool, ) -> Self
Add a navigation item.
Sourcepub fn item_with_callback<F>(
self,
text: impl Into<String>,
icon: Option<impl Into<String>>,
active: bool,
callback: F,
) -> Self
pub fn item_with_callback<F>( self, text: impl Into<String>, icon: Option<impl Into<String>>, active: bool, callback: F, ) -> Self
Add a navigation item with callback.
Sourcepub fn add_item(self, item: DrawerItem) -> Self
pub fn add_item(self, item: DrawerItem) -> Self
Add a drawer item object.
Sourcepub fn section(
self,
label: Option<impl Into<String>>,
items: Vec<DrawerItem>,
) -> Self
pub fn section( self, label: Option<impl Into<String>>, items: Vec<DrawerItem>, ) -> Self
Add a section with label and items.
Sourcepub fn corner_radius(self, corner_radius: impl Into<CornerRadius>) -> Self
pub fn corner_radius(self, corner_radius: impl Into<CornerRadius>) -> Self
Set corner radius.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MaterialDrawer<'a>
impl<'a> !RefUnwindSafe for MaterialDrawer<'a>
impl<'a> Send for MaterialDrawer<'a>
impl<'a> Sync for MaterialDrawer<'a>
impl<'a> Unpin for MaterialDrawer<'a>
impl<'a> UnsafeUnpin for MaterialDrawer<'a>
impl<'a> !UnwindSafe for MaterialDrawer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more