pub use taffy::prelude::*;
pub struct LayoutStyle;
impl LayoutStyle {
pub fn flex_container() -> Style {
Style {
display: Display::Flex,
..Default::default()
}
}
pub fn flex_row() -> Style {
Style {
display: Display::Flex,
flex_direction: FlexDirection::Row,
..Default::default()
}
}
pub fn flex_column() -> Style {
Style {
display: Display::Flex,
flex_direction: FlexDirection::Column,
..Default::default()
}
}
pub fn centered() -> Style {
Style {
display: Display::Flex,
justify_content: Some(JustifyContent::Center),
align_items: Some(AlignItems::Center),
..Default::default()
}
}
pub fn fixed_size(width: f32, height: f32) -> Style {
Style {
size: Size {
width: Dimension::Length(width),
height: Dimension::Length(height),
},
..Default::default()
}
}
}