From db92e1c942154bee474fee5e2c187f8a52a1bb96 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 4 Mar 2024 19:32:20 +0100 Subject: Enhnace `Themer` to allow derivation from current `Theme` --- widget/src/helpers.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'widget/src/helpers.rs') diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index ed385ea5..e6322926 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -15,7 +15,6 @@ use crate::rule::{self, Rule}; use crate::runtime::Command; use crate::scrollable::{self, Scrollable}; use crate::slider::{self, Slider}; -use crate::style::application; use crate::text::{self, Text}; use crate::text_editor::{self, TextEditor}; use crate::text_input::{self, TextInput}; @@ -440,13 +439,13 @@ where } /// A widget that applies any `Theme` to its contents. -pub fn themer<'a, Message, Theme, Renderer>( - theme: Theme, - content: impl Into>, -) -> Themer<'a, Message, Theme, Renderer> +pub fn themer<'a, Message, OldTheme, NewTheme, F, Renderer>( + to_theme: F, + content: impl Into>, +) -> Themer<'a, Message, OldTheme, NewTheme, F, Renderer> where + F: Fn(&OldTheme) -> NewTheme, Renderer: core::Renderer, - Theme: application::StyleSheet, { - Themer::new(theme, content) + Themer::new(to_theme, content) } -- cgit