Fusuma

Components / Components

dismissible_alert

An alert with a close button: pressing it sends on_dismiss, and the app stops showing the alert (the view for it is left out, or wrapped in show).

How it looks

Drawn by the toolkit from the example below. No page of the gallery uses dismissible_alert yet, so there is nothing to run.

dismissible_alert drawn by Fusuma

An alert with a close button: pressing it sends on_dismiss, and the app stops showing the alert (the view for it is left out, or wrapped in show).

Signature

pub fn dismissible_alert<'a, M: Clone + 'a>( tone: Tone, title: &'a str, body: &'a str, on_dismiss: M, ) -> impl View<M> + 'a

Example

use fusuma::{Tone, dismissible_alert};
let view = dismissible_alert(Tone::Warning, "Low battery", "Plug in soon.", ());
let built = fusuma::doc::built::<(), _>(&view);
assert!(built.texts().contains(&"Low battery"));

All components · Source