pub struct TopAppBar { /* private fields */ }Expand description
An M3 Expressive top app bar.
Implementations§
Source§impl TopAppBar
impl TopAppBar
pub fn new(id: impl Into<ElementId>, variant: TopAppBarVariant) -> Self
pub fn title(self, title: impl Into<SharedString>) -> Self
Sourcepub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
pub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
Supporting text under the title.
Sourcepub fn title_content(self, content: impl IntoElement) -> Self
pub fn title_content(self, content: impl IntoElement) -> Self
A caller element in the title’s place, e.g. a logo or image. A text title, if also set, stays the bar’s accessible heading.
Sourcepub fn centered(self, centered: bool) -> Self
pub fn centered(self, centered: bool) -> Self
Center a flexible bar’s titles (center-aligned bars always are).
The leading navigation control, e.g. a menu or back icon button.
Sourcepub fn action(self, action: impl IntoElement) -> Self
pub fn action(self, action: impl IntoElement) -> Self
A trailing action, e.g. an icon button or avatar.
pub fn actions<E: IntoElement>( self, actions: impl IntoIterator<Item = E>, ) -> Self
Sourcepub fn scrolled_under(self, scrolled: bool) -> Self
pub fn scrolled_under(self, scrolled: bool) -> Self
How far the content under the bar has scrolled, in design px. Override the scrolled-under state the offset implies, e.g. for a bar over content the caller knows is scrolled, or a static specimen. A flexible bar still collapses with the offset alone.
Sourcepub fn container(self, role: ColorRole) -> Self
pub fn container(self, role: ColorRole) -> Self
The flat container role (surface by default), e.g. the surface-container-lowest of the content pane a bar heads. Scrolled under, the bar still fades to surface-container.
pub fn scroll_offset(self, offset: f32) -> Self
Sourcepub fn search_placeholder(self, placeholder: impl Into<SharedString>) -> Self
pub fn search_placeholder(self, placeholder: impl Into<SharedString>) -> Self
The search field’s placeholder (search bars).
Sourcepub fn on_search(
self,
handler: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_search( self, handler: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self
Activating the search field, e.g. to open a search view.
Sourcepub fn preview_state(self, state: InteractionPreview) -> Self
pub fn preview_state(self, state: InteractionPreview) -> Self
Render the search field as a static specimen in one forced
interaction state. See InteractionPreview.
Trait Implementations§
Source§impl IntoElement for TopAppBar
impl IntoElement for TopAppBar
Source§type Element = ViewElement<TopAppBar>
type Element = ViewElement<TopAppBar>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Auto Trait Implementations§
impl !RefUnwindSafe for TopAppBar
impl !Send for TopAppBar
impl !Sync for TopAppBar
impl !UnwindSafe for TopAppBar
impl Freeze for TopAppBar
impl Unpin for TopAppBar
impl UnsafeUnpin for TopAppBar
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,
§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,
§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,
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
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,
§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,
§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,
§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> ⓘ
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> ⓘ
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
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
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.