From 6146382676a7bff4764e86e99d0d053f5fbbc045 Mon Sep 17 00:00:00 2001 From: Richard Custodio Date: Mon, 18 Mar 2024 16:48:15 -0300 Subject: feat: add `text` macro to `widget::helpers` --- widget/src/helpers.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 4863e550..1b57cd21 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -51,6 +51,19 @@ macro_rules! row { ); } +/// Creates a new [`Text`] widget with the provided content. +/// +/// [`Text`]: core::widget::Text +#[macro_export] +macro_rules! text { + () => ( + $crate::Text::new() + ); + ($($arg:tt)*) => { + $crate::Text::new(format!($($arg)*)) + }; +} + /// Creates a new [`Container`] with the provided content. /// /// [`Container`]: crate::Container -- cgit