summaryrefslogtreecommitdiffstats
path: root/widget/src/helpers.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-02-15 02:57:52 +0100
committerLibravatar GitHub <noreply@github.com>2024-02-15 02:57:52 +0100
commit84cc9f130b4e29219d47db42cdb76548b054c66b (patch)
tree5758716b7ca1a35e589969efd9537f5e56dd1e27 /widget/src/helpers.rs
parent5827023ccc3f80012b17dbfe778fbd8b63186c99 (diff)
parent777e2e34f50c440f59d9a407f75be80fbbfaccae (diff)
downloadiced-84cc9f130b4e29219d47db42cdb76548b054c66b.tar.gz
iced-84cc9f130b4e29219d47db42cdb76548b054c66b.tar.bz2
iced-84cc9f130b4e29219d47db42cdb76548b054c66b.zip
Merge pull request #2253 from iced-rs/improve-ergonomics
Improve some widget ergonomics
Diffstat (limited to 'widget/src/helpers.rs')
-rw-r--r--widget/src/helpers.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs
index e9898d67..3f2e56cd 100644
--- a/widget/src/helpers.rs
+++ b/widget/src/helpers.rs
@@ -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.
@@ -387,6 +387,18 @@ where
crate::Canvas::new(program)
}
+/// Creates a new [`QRCode`] widget from the given [`Data`].
+///
+/// [`QRCode`]: crate::QRCode
+/// [`Data`]: crate::qr_code::Data
+#[cfg(feature = "qr_code")]
+pub fn qr_code<Theme>(data: &crate::qr_code::Data) -> crate::QRCode<'_, Theme>
+where
+ Theme: crate::qr_code::StyleSheet,
+{
+ crate::QRCode::new(data)
+}
+
/// Creates a new [`Shader`].
///
/// [`Shader`]: crate::Shader