StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | use pathfinder_color::ColorU; |
| 2 | use strato_ui::{elements::Rect, AppContext, Element, Entity, TypedActionView, View}; |
| 3 | |
| 4 | pub struct BlurredView {} |
| 5 | |
| 6 | impl Entity for BlurredView { |
| 7 | type Event = (); |
| 8 | } |
| 9 | impl View for BlurredView { |
| 10 | fn ui_name() -> &'static str { |
| 11 | "RootView" |
| 12 | } |
| 13 | |
| 14 | /// Renders a transparent red rectangle. The blur effect is applied on the window (see |
| 15 | /// `open_new()`. |
| 16 | fn render(&self, _: &AppContext) -> Box<dyn Element> { |
| 17 | Rect::new() |
| 18 | .with_background_color(ColorU::new(255, 0, 0, 50)) |
| 19 | .finish() |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | impl TypedActionView for BlurredView { |
| 24 | type Action = (); |
| 25 | } |
| 26 |