diff options
Diffstat (limited to 'widget/src')
-rw-r--r-- | widget/src/column.rs | 15 | ||||
-rw-r--r-- | widget/src/container.rs | 47 | ||||
-rw-r--r-- | widget/src/helpers.rs | 4 | ||||
-rw-r--r-- | widget/src/row.rs | 15 |
4 files changed, 10 insertions, 71 deletions
diff --git a/widget/src/column.rs b/widget/src/column.rs index ef4ee99d..ae82ccaa 100644 --- a/widget/src/column.rs +++ b/widget/src/column.rs @@ -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()); diff --git a/widget/src/container.rs b/widget/src/container.rs index adfe347c..cf27bf96 100644 --- a/widget/src/container.rs +++ b/widget/src/container.rs @@ -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`]. diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index f27b7807..1f282f54 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -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() } diff --git a/widget/src/row.rs b/widget/src/row.rs index 129feb7e..3feeaa7e 100644 --- a/widget/src/row.rs +++ b/widget/src/row.rs @@ -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()); |