pub struct StatusBar { /* private fields */ }Expand description
The one line at the foot of an app window that is always there: the version, what is going on in the background, a notice with its actions.
Where a Footer ends a page and wraps or stacks to show everything, a
status bar keeps one fixed line: its sides keep their width and the center
takes the rest, cutting what does not fit, so it never pushes the app around.
Tinting the center with Self::center_tone makes a notice stand out without
the whole bar shouting. The center is announced to screen readers as a status.
use ravenrs_widgets::{StatusBar, Tone, ViewExt};
let bar = StatusBar::new()
.left((StatusBar::action("Version 1.2"),))
.center((StatusBar::text("Version 1.3 is available").truncate().grow(1.0), StatusBar::action("Update")))
.center_tone(Tone::Warning)
.right((StatusBar::text("12 items"),));Implementations§
Source§impl StatusBar
impl StatusBar
Sourcepub fn text(text: impl Into<String>) -> Text
pub fn text(text: impl Into<String>) -> Text
Text in a status bar’s usual look: small and muted.
Sourcepub fn action(label: impl Into<String>) -> Button
pub fn action(label: impl Into<String>) -> Button
An action that fits the line: a mini ghost Button, with a focus ring
and the keyboard. Add on_click to it.
Sourcepub fn center(self, items: impl ViewSeq + 'static) -> StatusBar
pub fn center(self, items: impl ViewSeq + 'static) -> StatusBar
The views in the middle, which get the width the sides leave. Give the
text .truncate().grow(1.0) so that it is what gets cut.
Sourcepub fn center_tone(self, tone: Tone) -> StatusBar
pub fn center_tone(self, tone: Tone) -> StatusBar
Tints the middle, and only the middle, to make a notice stand out.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StatusBar
impl !Send for StatusBar
impl !Sync for StatusBar
impl !UnwindSafe for StatusBar
impl Freeze for StatusBar
impl Unpin for StatusBar
impl UnsafeUnpin for StatusBar
Blanket Implementations§
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<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.