Skip to main content

Module modal_sheet

Module modal_sheet 

Source
Expand description

ModalSheet — a centered modal panel over a dimming scrim, the SwiftUI-.sheet / desktop-dialog presentation.

Unlike Window the sheet is not draggable, resizable, or collapsible: it is a fixed-size surface centered over the app, with a translucent scrim blocking interaction with everything behind it. Place it as a late child of the root Stack so it paints above the app; while its visibility cell is true, has_active_modal routes all input to the sheet subtree (the scrim swallows what the panel doesn’t use) and Escape closes it.

let visible = Rc::new(Cell::new(false));
let sheet = ModalSheet::new(Rc::clone(&visible), Box::new(content))
    .with_panel_size(Size::new(620.0, 420.0));
Stack::new().add(Box::new(app)).add(Box::new(sheet))

Structs§

ModalSheet
A centered, fixed-size modal panel over a scrim. One content child.