Leverage DefaultStyle traits instead of Default
This commit is contained in:
parent
44f002f64a
commit
833538ee7f
30 changed files with 393 additions and 437 deletions
|
|
@ -34,12 +34,12 @@ where
|
|||
/// Creates a new [`Content`] with the provided body.
|
||||
pub fn new(body: impl Into<Element<'a, Message, Theme, Renderer>>) -> Self
|
||||
where
|
||||
container::Style<Theme>: Default,
|
||||
Theme: container::DefaultStyle,
|
||||
{
|
||||
Self {
|
||||
title_bar: None,
|
||||
body: body.into(),
|
||||
style: container::Style::default(),
|
||||
style: Theme::default_style(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ where
|
|||
container::Status::Idle
|
||||
};
|
||||
|
||||
self.style.resolve(theme, status)
|
||||
(self.style)(theme, status)
|
||||
};
|
||||
|
||||
container::draw_background(renderer, &style, bounds);
|
||||
|
|
@ -403,8 +403,8 @@ impl<'a, T, Message, Theme, Renderer> From<T>
|
|||
for Content<'a, Message, Theme, Renderer>
|
||||
where
|
||||
T: Into<Element<'a, Message, Theme, Renderer>>,
|
||||
Theme: container::DefaultStyle,
|
||||
Renderer: crate::core::Renderer,
|
||||
container::Style<Theme>: Default,
|
||||
{
|
||||
fn from(element: T) -> Self {
|
||||
Self::new(element)
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@ where
|
|||
content: impl Into<Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self
|
||||
where
|
||||
container::Style<Theme>: Default,
|
||||
Theme: container::DefaultStyle,
|
||||
{
|
||||
Self {
|
||||
content: content.into(),
|
||||
controls: None,
|
||||
padding: Padding::ZERO,
|
||||
always_show_controls: false,
|
||||
style: container::Style::default(),
|
||||
style: Theme::default_style(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ where
|
|||
container::Status::Idle
|
||||
};
|
||||
|
||||
self.style.resolve(theme, status)
|
||||
(self.style)(theme, status)
|
||||
};
|
||||
|
||||
let inherited_style = renderer::Style {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue