Re-export variants of Length and alignment types

This commit is contained in:
Héctor Ramón Jiménez 2024-07-12 18:12:34 +02:00
parent f9dd5cbb09
commit 76737351ea
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
51 changed files with 255 additions and 395 deletions

View file

@ -104,21 +104,6 @@ where
self
}
/// Centers the contents of the [`Column`] horizontally.
pub fn center_x(self) -> Self {
self.align_x(Alignment::Center)
}
/// Aligns the contents of the [`Column`] to the left.
pub fn align_left(self) -> Self {
self.align_x(alignment::left())
}
/// Aligns the contents of the [`Column`] to the right.
pub fn align_right(self) -> Self {
self.align_x(alignment::right())
}
/// Sets the horizontal alignment of the contents of the [`Column`] .
pub fn align_x(mut self, align: impl Into<alignment::Horizontal>) -> Self {
self.align = Alignment::from(align.into());

View file

@ -92,37 +92,6 @@ where
self
}
/// Sets the [`Container`] to fill the available space in the horizontal axis.
///
/// Calling this method is equivalent to calling [`width`] with a
/// [`Length::Fill`].
///
/// [`width`]: Self::width
pub fn fill_x(self) -> Self {
self.width(Length::Fill)
}
/// Sets the [`Container`] to fill the available space in the vertical axis.
///
/// Calling this method is equivalent to calling [`height`] with a
/// [`Length::Fill`].
///
/// [`height`]: Self::height
pub fn fill_y(self) -> Self {
self.height(Length::Fill)
}
/// Sets the [`Container`] to fill all the available space.
///
/// Calling this method is equivalent to chaining [`fill_x`] and
/// [`fill_y`].
///
/// [`fill_x`]: Self::fill_x
/// [`fill_y`]: Self::fill_y
pub fn fill(self) -> Self {
self.width(Length::Fill).height(Length::Fill)
}
/// Sets the maximum width of the [`Container`].
pub fn max_width(mut self, max_width: impl Into<Pixels>) -> Self {
self.max_width = max_width.into().0;
@ -159,23 +128,23 @@ where
}
/// Aligns the contents of the [`Container`] to the left.
pub fn align_left(self) -> Self {
self.align_x(alignment::left())
pub fn align_left(self, width: impl Into<Length>) -> Self {
self.width(width).align_x(alignment::Horizontal::Left)
}
/// Aligns the contents of the [`Container`] to the right.
pub fn align_right(self) -> Self {
self.align_x(alignment::right())
pub fn align_right(self, width: impl Into<Length>) -> Self {
self.width(width).align_x(alignment::Horizontal::Right)
}
/// Aligns the contents of the [`Container`] to the top.
pub fn align_top(self) -> Self {
self.align_y(alignment::top())
pub fn align_top(self, height: Length) -> Self {
self.height(height).align_y(alignment::Vertical::Top)
}
/// Aligns the contents of the [`Container`] to the bottom.
pub fn align_bottom(self) -> Self {
self.align_y(alignment::bottom())
pub fn align_bottom(self, height: Length) -> Self {
self.height(height).align_y(alignment::Vertical::Bottom)
}
/// Sets the content alignment for the horizontal axis of the [`Container`].

View file

@ -906,7 +906,7 @@ where
+ 'a,
Theme: text::Catalog + crate::svg::Catalog + 'a,
{
use crate::core::Font;
use crate::core::{Alignment, Font};
use crate::svg;
use once_cell::sync::Lazy;
@ -921,7 +921,7 @@ where
text("iced").size(text_size).font(Font::MONOSPACE)
]
.spacing(text_size.0 / 3.0)
.center_y()
.align_y(Alignment::Center)
.into()
}

View file

@ -95,21 +95,6 @@ where
self
}
/// Centers the contents of the [`Row`] vertically.
pub fn center_y(self) -> Self {
self.align_y(Alignment::Center)
}
/// Aligns the contents of the [`Row`] to the top.
pub fn align_top(self) -> Self {
self.align_y(alignment::top())
}
/// Aligns the contents of the [`Row`] to the bottom.
pub fn align_bottom(self) -> Self {
self.align_y(alignment::bottom())
}
/// Sets the vertical alignment of the contents of the [`Row`] .
pub fn align_y(mut self, align: impl Into<alignment::Vertical>) -> Self {
self.align = Alignment::from(align.into());