Merge pull request #2904 from edwloef/grid-helper

Add `grid!` macro helper
This commit is contained in:
Héctor 2025-11-25 21:38:24 +01:00 committed by GitHub
commit 93735975b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,6 +113,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