pub struct SplashScreen { /* private fields */ }Expand description
The opening screen that covers the window while the app loads: a logo or icon, the app’s name, a status message and its progress.
It takes no input and has nothing to focus, so the page behind it stays out
of reach until the app sets visible to false and the screen fades out. It
is on screen from the very first frame, with no fade in. Without
Self::progress it shows a Spinner.
Status and progress are plain values, so build it where they are read, such
as in a Component body or a view_fn.
use ravenrs_reactive::State;
use ravenrs_widgets::{IconName, SplashScreen, View, view_fn};
let loading = State::new(true);
let progress = State::new(0.25);
let splash = view_fn(move || {
SplashScreen::new(loading.binding(), "Raven Finance")
.icon(IconName::Wallet)
.status("Opening the database")
.progress(progress.get())
});Implementations§
Source§impl SplashScreen
impl SplashScreen
Sourcepub fn new(visible: Binding<bool>, name: impl Into<String>) -> Self
pub fn new(visible: Binding<bool>, name: impl Into<String>) -> Self
A splash screen for the app called name, shown while visible is true.
Sourcepub fn logo(self, logo: impl View + 'static) -> Self
pub fn logo(self, logo: impl View + 'static) -> Self
Shows the app’s own artwork above the name, such as an Image.
It replaces Self::icon.
Sourcepub fn status(self, status: impl Into<String>) -> Self
pub fn status(self, status: impl Into<String>) -> Self
Sets the one-line message under the name. Screen readers announce each new one.
Sourcepub fn progress(self, value: f32) -> Self
pub fn progress(self, value: f32) -> Self
Replaces the spinner with a progress bar at value, clamped to 0.0–1.0.
Sourcepub fn reveal_after(self, seconds: f64) -> Self
pub fn reveal_after(self, seconds: f64) -> Self
Holds the name back this many seconds, and what is under it a little longer,
for an animated Self::logo to play alone. Their places are kept, so nothing
moves when they appear, and screen readers have them from the start. Where
motion is reduced they show at once.
Trait Implementations§
Source§impl Debug for SplashScreen
impl Debug for SplashScreen
Auto Trait Implementations§
impl !RefUnwindSafe for SplashScreen
impl !Send for SplashScreen
impl !Sync for SplashScreen
impl !UnwindSafe for SplashScreen
impl Freeze for SplashScreen
impl Unpin for SplashScreen
impl UnsafeUnpin for SplashScreen
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§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<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.