Merge pull request #2871 from JL710/container_docs

improve center/align docs of container
This commit is contained in:
Héctor 2025-11-25 08:48:00 +01:00 committed by GitHub
commit 25229b0960
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,8 +151,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`].
///
@ -164,22 +164,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)
}