Add theme::Application styling support to Sandbox
This commit is contained in:
parent
bb07d017e8
commit
3514bd1535
2 changed files with 22 additions and 62 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue