diff options
Diffstat (limited to 'crates/material_theme/src')
| -rw-r--r-- | crates/material_theme/src/lib.rs | 1 | ||||
| -rw-r--r-- | crates/material_theme/src/rule.rs | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/crates/material_theme/src/lib.rs b/crates/material_theme/src/lib.rs index 03f1ca5..2452d88 100644 --- a/crates/material_theme/src/lib.rs +++ b/crates/material_theme/src/lib.rs @@ -17,6 +17,7 @@ pub mod progress_bar; #[cfg(feature = "qr_code")] pub mod qr_code; pub mod radio; +pub mod rule; pub mod scrollable; pub mod slider; #[cfg(feature = "svg")] diff --git a/crates/material_theme/src/rule.rs b/crates/material_theme/src/rule.rs new file mode 100644 index 0000000..e433005 --- /dev/null +++ b/crates/material_theme/src/rule.rs @@ -0,0 +1,33 @@ +use iced_widget::core::border::Radius; +use iced_widget::rule::{Catalog, FillMode, Style, StyleFn}; + +use super::Theme; + +impl Catalog for Theme { + type Class<'a> = StyleFn<'a, Self>; + + fn default<'a>() -> Self::Class<'a> { + Box::new(inset) + } + + fn style(&self, class: &Self::Class<'_>) -> Style { + class(self) + } +} + +pub fn inset(theme: &Theme) -> Style { + Style { + color: theme.colorscheme.outline.variant, + fill_mode: FillMode::Padded(8), + width: 1, + radius: Radius::default(), + } +} +pub fn full_width(theme: &Theme) -> Style { + Style { + color: theme.colorscheme.outline.variant, + fill_mode: FillMode::Full, + width: 1, + radius: Radius::default(), + } +} |
