Add theme::Application styling support to Sandbox

This commit is contained in:
Héctor Ramón Jiménez 2022-07-08 20:13:14 +02:00
parent bb07d017e8
commit 3514bd1535
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 22 additions and 62 deletions

View file

@ -1,6 +1,5 @@
use crate::{
Application, Command, Element, Error, Settings, Subscription, Theme,
};
use crate::theme::{self, Theme};
use crate::{Application, Command, Element, Error, Settings, Subscription};
/// A sandboxed [`Application`].
///
@ -121,6 +120,13 @@ pub trait Sandbox {
Theme::default()
}
/// Returns the current style variant of [`theme::Application`].
///
/// By default, it returns [`theme::Application::default`].
fn style(&self) -> theme::Application {
theme::Application::default()
}
/// Returns the scale factor of the [`Sandbox`].
///
/// It can be used to dynamically control the size of the UI at runtime
@ -186,6 +192,10 @@ where
T::theme(self)
}
fn style(&self) -> theme::Application {
T::style(self)
}
fn subscription(&self) -> Subscription<T::Message> {
Subscription::none()
}