Reintroduce Box for style_sheet in Container
This commit is contained in:
parent
fcc282bd76
commit
40a5de5811
12 changed files with 51 additions and 30 deletions
|
|
@ -150,7 +150,7 @@ impl Application for GameOfLife {
|
|||
Container::new(content)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.style(&style::Container)
|
||||
.style(style::Container)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,9 +178,9 @@ impl Application for Example {
|
|||
.controls(pane.controls.view(id, total_panes, pane.is_pinned))
|
||||
.padding(10)
|
||||
.style(if is_focused {
|
||||
&style::TitleBar::Focused
|
||||
style::TitleBar::Focused
|
||||
} else {
|
||||
&style::TitleBar::Active
|
||||
style::TitleBar::Active
|
||||
});
|
||||
|
||||
pane_grid::Content::new(pane.content.view(
|
||||
|
|
@ -190,9 +190,9 @@ impl Application for Example {
|
|||
))
|
||||
.title_bar(title_bar)
|
||||
.style(if is_focused {
|
||||
&style::Pane::Focused
|
||||
style::Pane::Focused
|
||||
} else {
|
||||
&style::Pane::Active
|
||||
style::Pane::Active
|
||||
})
|
||||
})
|
||||
.width(Length::Fill)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ impl Sandbox for ScrollableDemo {
|
|||
Container::new(scrollable)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.style(theme.clone().into()),
|
||||
.style(*theme),
|
||||
)
|
||||
.push(ProgressBar::new(
|
||||
0.0..=1.0,
|
||||
|
|
@ -190,7 +190,7 @@ impl Sandbox for ScrollableDemo {
|
|||
.height(Length::Fill)
|
||||
.center_x()
|
||||
.center_y()
|
||||
.style(self.theme.into())
|
||||
.style(self.theme)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ impl Default for Theme {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Theme> for &'static dyn container::StyleSheet {
|
||||
impl<'a> From<Theme> for Box<dyn container::StyleSheet + 'a> {
|
||||
fn from(theme: Theme) -> Self {
|
||||
match theme {
|
||||
Theme::Light => Default::default(),
|
||||
Theme::Dark => &dark::Container,
|
||||
Theme::Dark => dark::Container.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ impl Sandbox for Styling {
|
|||
.height(Length::Fill)
|
||||
.center_x()
|
||||
.center_y()
|
||||
.style(self.theme.into())
|
||||
.style(self.theme)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
|
@ -176,11 +176,11 @@ mod style {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Theme> for &'static dyn container::StyleSheet {
|
||||
impl<'a> From<Theme> for Box<dyn container::StyleSheet + 'a> {
|
||||
fn from(theme: Theme) -> Self {
|
||||
match theme {
|
||||
Theme::Light => Default::default(),
|
||||
Theme::Dark => &dark::Container,
|
||||
Theme::Dark => dark::Container.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ fn tooltip<'a>(
|
|||
)
|
||||
.gap(5)
|
||||
.padding(10)
|
||||
.style(&style::Tooltip)
|
||||
.style(style::Tooltip)
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue