pub struct NavigationDrawer { /* private fields */ }Expand description
An M3 navigation drawer over caller-controlled selection and open state.
Implementations§
Sourcepub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
label is the navigation landmark’s accessible name.
Sourcepub fn headline(self, headline: impl Into<SharedString>) -> Self
pub fn headline(self, headline: impl Into<SharedString>) -> Self
The title-small headline above the destinations.
Sourcepub fn items(self, items: impl IntoIterator<Item = NavItem>) -> Self
pub fn items(self, items: impl IntoIterator<Item = NavItem>) -> Self
The destinations. Values must be unique.
Sourcepub fn section(self, before: usize, label: impl Into<SharedString>) -> Self
pub fn section(self, before: usize, label: impl Into<SharedString>) -> Self
A section label above item before; sections after the first are
separated by a middle-inset divider.
pub fn selected(self, value: impl Into<SharedString>) -> Self
Sourcepub fn modal(self, modal: bool) -> Self
pub fn modal(self, modal: bool) -> Self
Float over the content with a scrim instead of sitting beside it.
pub fn position(self, position: DrawerPosition) -> Self
Sourcepub fn focus_on_open(self, focus: bool) -> Self
pub fn focus_on_open(self, focus: bool) -> Self
Whether opening a modal drawer moves focus to its selected destination (on by default). Turn it off when the drawer opens in response to typing elsewhere, such as a search field filtering its destinations.
pub fn on_change( self, handler: impl Fn(&SharedString, &mut Window, &mut App) + 'static, ) -> Self
Sourcepub fn on_dismiss(
self,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn on_dismiss( self, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
A modal drawer’s Escape key and scrim click call this; without it the drawer is not dismissible.
Trait Implementations§
Source§type Element = ViewElement<NavigationDrawer>
type Element = ViewElement<NavigationDrawer>
The specific type of element into which the implementing type is converted.
Useful for converting other types into elements automatically, like Strings
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Convert self into a type that implements [
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
Convert self into a dynamically-typed [
AnyElement].Auto Trait Implementations§
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with an animation
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with a chain of animations
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
Renders this component or element at the value produced by a spring. Read more
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Imperatively modify self with the given closure.
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
With
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Like [
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.