Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
examples/taffy_demo/src/main.rs
1use strato_core::taffy::prelude::*;
2use strato_platform::{ApplicationBuilder, WindowBuilder};
3use strato_widgets::prelude::*;
4 
5fn main() {
6 strato_core::init();
7 
8 tracing::info!("Starting Taffy Demo");
9 
10 // 1. Create a widget tree
11 // We use a Column as the root container
12 let root = Column::new()
13 .spacing(10.0)
14 .child(Box::new(
15 Row::new()
16 .spacing(5.0)
17 .child(Box::new(Button::new("Button 1")))
18 .child(Box::new(Button::new("Button 2")))
19 .child(Box::new(Button::new("Button 3"))),
20 ))
21 .child(Box::new(
22 Stack::new().child(Box::new(Button::new("Overlay Button"))),
23 ));
24 
25 // 2. Run the application
26 ApplicationBuilder::new()
27 .title("Taffy Demo")
28 .window(WindowBuilder::new().with_size(800.0, 600.0).resizable(true))
29 .with_taffy(true) // Enable Taffy layout engine
30 .run(root);
31}
32