1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
use crate::{ widget, widget::unit::size::{SizeBoxNode, SizeBoxSizeValue}, widget_component, Scalar, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct SpaceBoxProps { #[serde(default)] pub width: Scalar, #[serde(default)] pub height: Scalar, } implement_props_data!(SpaceBoxProps); widget_component! { pub space_box(id, props) { let SpaceBoxProps { width, height } = props.read_cloned_or_default(); widget! {{{ SizeBoxNode { id: id.to_owned(), props: props.clone(), width: SizeBoxSizeValue::Exact(width), height: SizeBoxSizeValue::Exact(height), ..Default::default() } }}} } }