From 43a7ad72ef070929278e6d03d98077ac267fe2a6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 11 Feb 2022 18:42:15 +0700 Subject: Expose function helpers to build widgets in `pure::widget` `button("Hello")` is easier to write and read than `Button::new("Hello")`. --- pure/src/widget.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pure/src/widget.rs') diff --git a/pure/src/widget.rs b/pure/src/widget.rs index bf63b999..7215e99e 100644 --- a/pure/src/widget.rs +++ b/pure/src/widget.rs @@ -71,3 +71,20 @@ pub trait Widget { event::Status::Ignored } } + +pub fn column() -> Column { + Column::new() +} + +pub fn button( + content: impl Into>, +) -> Button { + Button::new(content) +} + +pub fn text(text: impl ToString) -> Text +where + Renderer: iced_native::text::Renderer, +{ + Text::new(text) +} -- cgit