From 7c4bf70023a8092faad9630c2c87fbf41bd6ab76 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 6 Mar 2024 21:27:03 +0100 Subject: Simplify theming for `Application` --- src/sandbox.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/sandbox.rs') diff --git a/src/sandbox.rs b/src/sandbox.rs index 28461929..815652ae 100644 --- a/src/sandbox.rs +++ b/src/sandbox.rs @@ -1,5 +1,5 @@ -use crate::theme::{self, Theme}; -use crate::{Application, Command, Element, Error, Settings, Subscription}; +use crate::application::{self, Application}; +use crate::{Command, Element, Error, Settings, Subscription, Theme}; /// A sandboxed [`Application`]. /// @@ -123,8 +123,8 @@ pub trait Sandbox { /// Returns the current style variant of [`theme::Application`]. /// /// By default, it returns [`theme::Application::default`]. - fn style(&self) -> theme::Application { - theme::Application::default() + fn style(&self, theme: &Theme) -> application::Appearance { + crate::shell::application::default(theme) } /// Returns the scale factor of the [`Sandbox`]. @@ -185,8 +185,8 @@ where T::theme(self) } - fn style(&self) -> theme::Application { - T::style(self) + fn style(&self, theme: &Theme) -> application::Appearance { + T::style(self, theme) } fn subscription(&self) -> Subscription { -- cgit From 6785a452eea5f6b6f69bac123789245dacbc936e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 7 Mar 2024 00:19:24 +0100 Subject: Fix broken links in documentation --- src/sandbox.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/sandbox.rs') diff --git a/src/sandbox.rs b/src/sandbox.rs index 815652ae..ab0e8d3d 100644 --- a/src/sandbox.rs +++ b/src/sandbox.rs @@ -120,9 +120,7 @@ pub trait Sandbox { Theme::default() } - /// Returns the current style variant of [`theme::Application`]. - /// - /// By default, it returns [`theme::Application::default`]. + /// Returns the current [`application::Appearance`]. fn style(&self, theme: &Theme) -> application::Appearance { crate::shell::application::default(theme) } -- cgit From 833538ee7f3a60a839304762dfc29b0881d19094 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 7 Mar 2024 20:11:32 +0100 Subject: Leverage `DefaultStyle` traits instead of `Default` --- src/sandbox.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/sandbox.rs') diff --git a/src/sandbox.rs b/src/sandbox.rs index ab0e8d3d..568b673e 100644 --- a/src/sandbox.rs +++ b/src/sandbox.rs @@ -122,7 +122,9 @@ pub trait Sandbox { /// Returns the current [`application::Appearance`]. fn style(&self, theme: &Theme) -> application::Appearance { - crate::shell::application::default(theme) + use application::DefaultStyle; + + theme.default_style() } /// Returns the scale factor of the [`Sandbox`]. -- cgit