Make horizontal_space and vertical_space fill by default
This commit is contained in:
parent
9dd20ead08
commit
e8049af23d
16 changed files with 54 additions and 46 deletions
|
|
@ -305,15 +305,15 @@ where
|
|||
/// Creates a new horizontal [`Space`] with the given [`Length`].
|
||||
///
|
||||
/// [`Space`]: crate::Space
|
||||
pub fn horizontal_space(width: impl Into<Length>) -> Space {
|
||||
Space::with_width(width)
|
||||
pub fn horizontal_space() -> Space {
|
||||
Space::with_width(Length::Fill)
|
||||
}
|
||||
|
||||
/// Creates a new vertical [`Space`] with the given [`Length`].
|
||||
///
|
||||
/// [`Space`]: crate::Space
|
||||
pub fn vertical_space(height: impl Into<Length>) -> Space {
|
||||
Space::with_height(height)
|
||||
pub fn vertical_space() -> Space {
|
||||
Space::with_height(Length::Fill)
|
||||
}
|
||||
|
||||
/// Creates a horizontal [`Rule`] with the given height.
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ where
|
|||
content: RefCell::new(Content {
|
||||
size: Size::ZERO,
|
||||
layout: None,
|
||||
element: Element::new(horizontal_space(0)),
|
||||
element: Element::new(horizontal_space().width(0)),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,18 @@ impl Space {
|
|||
height: height.into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets the width of the [`Space`].
|
||||
pub fn width(mut self, width: impl Into<Length>) -> Self {
|
||||
self.width = width.into();
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the height of the [`Space`].
|
||||
pub fn height(mut self, height: impl Into<Length>) -> Self {
|
||||
self.height = height.into();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer> for Space
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue