add macro helper for grid

This commit is contained in:
edwloef 2025-04-26 10:30:12 +02:00
parent afc562d336
commit 5451208ab8
No known key found for this signature in database

View file

@ -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