Skip to main content

Dialog

Function Dialog 

Source
pub fn Dialog<C>(
    __arg0: DialogSpec,
    on_dismiss: impl Fn(DismissReason) + 'static,
    __arg2: C,
)
where C: Fn() + 'static,
Expand description

A modal dialog holding content, dismissed through on_dismiss.

on_dismiss receives why the dialog is closing, so an application can treat “tapped away” differently from “went back” — a draft, for example, is usually kept in one case and discarded in the other.

if open {
    Dialog(
        DialogSpec::default(),
        |_reason| { /* close it */ },
        || {
            Content();
        },
    );
}