From 5451208ab8c7595b1f52afe9a2641aa35c9f52fc Mon Sep 17 00:00:00 2001 From: edwloef Date: Sat, 26 Apr 2025 10:30:12 +0200 Subject: [PATCH] add macro helper for grid --- widget/src/helpers.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 82908f88..9ec5426e 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -110,6 +110,19 @@ macro_rules! stack { ); } +/// Creates a [`Grid`] with the given children. +/// +/// [`Grid`]: crate::Grid +#[macro_export] +macro_rules! grid { + () => ( + $crate::Grid::new() + ); + ($($x:expr),+ $(,)?) => ( + $crate::Grid::with_children([$($crate::core::Element::from($x)),+]) + ); +} + /// Creates a new [`Text`] widget with the provided content. /// /// [`Text`]: core::widget::Text