shadow.rs

 1use gpui::{
 2    div, prelude::*, px, rgb, size, App, AppContext, Bounds, ViewContext, WindowBounds,
 3    WindowOptions,
 4};
 5
 6struct Shadow {}
 7
 8impl Render for Shadow {
 9    fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
10        div()
11            .flex()
12            .bg(rgb(0xffffff))
13            .size_full()
14            .justify_center()
15            .items_center()
16            .child(div().size_8().shadow_sm())
17    }
18}
19
20fn main() {
21    App::new().run(|cx: &mut AppContext| {
22        let bounds = Bounds::centered(None, size(px(300.0), px(300.0)), cx);
23        cx.open_window(
24            WindowOptions {
25                window_bounds: Some(WindowBounds::Windowed(bounds)),
26                ..Default::default()
27            },
28            |cx| cx.new_view(|_cx| Shadow {}),
29        )
30        .unwrap();
31    });
32}