improve center/align docs of container

This commit is contained in:
JL710 2025-03-30 12:42:38 +02:00
parent beddf49c76
commit 6ecf7da43a

View file

@ -153,8 +153,8 @@ where
self.height(height).align_y(alignment::Vertical::Center)
}
/// Centers the contents in both the horizontal and vertical axes of the
/// [`Container`].
/// Sets the width and height of the [`Container`] and centers its contents in
/// both the horizontal and vertical axes.
///
/// This is equivalent to chaining [`center_x`] and [`center_y`].
///
@ -166,22 +166,22 @@ where
self.center_x(length).center_y(length)
}
/// Aligns the contents of the [`Container`] to the left.
/// Sets the width of the [`Container`] and aligns its contents to the 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.
/// Sets the width of the [`Container`] and aligns its contents to the 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.
/// Sets the height of the [`Container`] and aligns its contents to the top.
pub fn align_top(self, height: impl Into<Length>) -> Self {
self.height(height).align_y(alignment::Vertical::Top)
}
/// Aligns the contents of the [`Container`] to the bottom.
/// Sets the height of the [`Container`] and aligns its contents to the bottom.
pub fn align_bottom(self, height: impl Into<Length>) -> Self {
self.height(height).align_y(alignment::Vertical::Bottom)
}