Skip to content

Commit d09d90d

Browse files
committed
feat(style): Add Container::custom_fn method
1 parent e6dc51b commit d09d90d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

style/src/theme.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,13 @@ pub enum Container {
351351
Custom(Box<dyn container::StyleSheet<Style = Theme>>),
352352
}
353353

354+
impl Container {
355+
/// Creates a custom [`Container`] style.
356+
pub fn custom_fn(f: fn(&Theme) -> container::Appearance) -> Self {
357+
Self::Custom(Box::new(f))
358+
}
359+
}
360+
354361
impl From<fn(&Theme) -> container::Appearance> for Container {
355362
fn from(f: fn(&Theme) -> container::Appearance) -> Self {
356363
Self::Custom(Box::new(f))
@@ -362,7 +369,7 @@ impl container::StyleSheet for Theme {
362369

363370
fn appearance(&self, style: &Self::Style) -> container::Appearance {
364371
match style {
365-
Container::Transparent => Default::default(),
372+
Container::Transparent => container::Appearance::default(),
366373
Container::Box => {
367374
let palette = self.extended_palette();
368375

0 commit comments

Comments
 (0)