Refactor alignment types into an alignment module
This commit is contained in:
parent
5fae6e59ff
commit
a0ad399622
54 changed files with 402 additions and 377 deletions
|
|
@ -1,5 +1,6 @@
|
|||
//! Style your widgets.
|
||||
use crate::{bumpalo, Align, Background, Color, CrossAlign, Length, Padding};
|
||||
use crate::bumpalo;
|
||||
use crate::{Alignment, Background, Color, Length, Padding};
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
|
|
@ -195,22 +196,13 @@ pub fn background(background: Background) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the style value for the given [`Align`].
|
||||
pub fn align(align: Align) -> &'static str {
|
||||
match align {
|
||||
Align::Start => "flex-start",
|
||||
Align::Center => "center",
|
||||
Align::End => "flex-end",
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the style value for the given [`CrossAlign`].
|
||||
pub fn cross_align(align: CrossAlign) -> &'static str {
|
||||
match align {
|
||||
CrossAlign::Start => "flex-start",
|
||||
CrossAlign::Center => "center",
|
||||
CrossAlign::End => "flex-end",
|
||||
CrossAlign::Fill => "stretch",
|
||||
/// Returns the style value for the given [`Alignment`].
|
||||
pub fn alignment(alignment: Alignment) -> &'static str {
|
||||
match alignment {
|
||||
Alignment::Start => "flex-start",
|
||||
Alignment::Center => "center",
|
||||
Alignment::End => "flex-end",
|
||||
Alignment::Fill => "stretch",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue