API ReferenceDesign Systems
Toast
Retained notification queue with controller, provider, and styling.
use incular::prelude::*;
use incular::controls::toast::{Provider as ToastProvider, ToastController};
fn main() {
let controller = ToastController::new();
controller.push("Saved");
controller.push_with_description("Synced", Some("All changes synced"));
println!("toasts: {}", controller.len());
let app = Application::new(move |_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
ToastProvider::new()
.child(Text::new("App"))
.with_controller(controller.clone())
.max_visible(3),
)
.build()
.into()
})
.expect("valid application");
incular::run(app).expect("run application");
}| Method | Returns |
|---|---|
push(title) | ToastId |
push_with_description(title, desc) | ToastId |
dismiss(id) | bool |
clear() | Empties the queue |
len() / is_empty() | Queue inspection |
Defaults: surface width theme.toast.width (320), padding
theme.toast.padding (12), surface_elevated color, theme.toast.radius
(6). toast::Title / Description for parts; toast::Action = crate::button::Button.
Related: SnackBar.