use taffy::prelude::*;
use crate::color::Color;
use crate::reactive_value::Reactive;
use crate::style::Style;
use super::Div;
impl Div {
pub fn style(mut self, f: impl FnOnce(Style) -> Style) -> Self {
self.layout_style = f(self.layout_style);
self
}
pub fn background(mut self, color: impl Into<Reactive<Color>>) -> Self {
let value: Reactive<Color> = color.into();
self.visual.background = Some(value.resolve().0);
self
}
pub fn corner_radius(mut self, radius: impl Into<Reactive<f32>>) -> Self {
let value: Reactive<f32> = radius.into();
self.visual.corner_radius = value.resolve();
self
}
pub fn direction(mut self, direction: FlexDirection) -> Self {
self.layout_style.flex_direction = direction;
self
}
pub fn column(mut self) -> Self {
self.layout_style.flex_direction = FlexDirection::Column;
self
}
pub fn row(mut self) -> Self {
self.layout_style.flex_direction = FlexDirection::Row;
self
}
pub fn flex_grow(mut self, grow: f32) -> Self {
self.layout_style.flex_grow = grow;
self
}
pub fn gap(mut self, gap: f32) -> Self {
self.layout_style.gap = gap;
self
}
}