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 32 33 34 35 36 37
use crate::{ widget, widget::{ component::containers::flex_box::{flex_box, FlexBoxProps}, unit::flex::FlexBoxDirection, }, widget_component, Scalar, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct VerticalBoxProps { #[serde(default)] pub separation: Scalar, #[serde(default)] pub reversed: bool, } implement_props_data!(VerticalBoxProps, "VerticalBoxProps"); widget_component! { pub vertical_box(key, props, listed_slots) { let VerticalBoxProps { separation, reversed } = props.read_cloned_or_default(); let props = props.clone().with(FlexBoxProps { direction: if reversed { FlexBoxDirection::VerticalBottomToTop } else { FlexBoxDirection::VerticalTopToBottom }, separation, wrap: false, }); widget! { (#{key} flex_box: {props} |[ listed_slots ]|) } } }