pub struct FlexStyle {
pub direction: FlexDirection,
pub gap: f32,
pub align_items: AlignItems,
pub justify_content: JustifyContent,
}Expand description
Flex container style: direction, gap, and alignment.
§Examples
use ailloli_ui_core::style::{AlignItems, FlexStyle};
let style = FlexStyle::row().gap(8.0).align_items(AlignItems::Center);
assert_eq!(style.gap, 8.0);Fields§
§direction: FlexDirectionMain-axis orientation.
gap: f32Non-negative separation between adjacent children in logical pixels.
align_items: AlignItemsDefault cross-axis alignment for children.
justify_content: JustifyContentMain-axis packing/distribution policy.
Implementations§
Source§impl FlexStyle
impl FlexStyle
Sourcepub fn row() -> Self
pub fn row() -> Self
Creates a horizontal container with zero gap and start alignment.
§Examples
use ailloli_ui_core::style::{FlexDirection, FlexStyle};
assert_eq!(FlexStyle::row().direction, FlexDirection::Row);Sourcepub fn column() -> Self
pub fn column() -> Self
Creates a vertical container with zero gap and start alignment.
§Examples
use ailloli_ui_core::style::{FlexDirection, FlexStyle};
assert_eq!(FlexStyle::column().direction, FlexDirection::Column);Sourcepub fn gap(self, value: f32) -> Self
pub fn gap(self, value: f32) -> Self
Sets adjacent-child gap, clamped to at least zero logical pixels.
NaN and negative infinity become zero through floating-point max
semantics; positive infinity remains infinite.
§Examples
use ailloli_ui_core::style::FlexStyle;
assert_eq!(FlexStyle::row().gap(-2.0).gap, 0.0);Sourcepub fn align_items(self, value: AlignItems) -> Self
pub fn align_items(self, value: AlignItems) -> Self
Replaces the default cross-axis alignment.
§Examples
use ailloli_ui_core::style::{AlignItems, FlexStyle};
assert_eq!(FlexStyle::row().align_items(AlignItems::Stretch).align_items, AlignItems::Stretch);Sourcepub fn justify_content(self, value: JustifyContent) -> Self
pub fn justify_content(self, value: JustifyContent) -> Self
Replaces the main-axis distribution policy.
§Examples
use ailloli_ui_core::style::{FlexStyle, JustifyContent};
assert_eq!(FlexStyle::row().justify_content(JustifyContent::SpaceBetween).justify_content, JustifyContent::SpaceBetween);Trait Implementations§
impl Copy for FlexStyle
impl StructuralPartialEq for FlexStyle
Auto Trait Implementations§
impl Freeze for FlexStyle
impl RefUnwindSafe for FlexStyle
impl Send for FlexStyle
impl Sync for FlexStyle
impl Unpin for FlexStyle
impl UnwindSafe for FlexStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more