From 6300486b8ea51b75850708acb271fcce02666dd6 Mon Sep 17 00:00:00 2001 From: pml68 Date: Sat, 19 Apr 2025 01:10:11 +0200 Subject: feat(material_theme): implement `rule::Catalog` --- crates/material_theme/src/rule.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 crates/material_theme/src/rule.rs (limited to 'crates/material_theme/src/rule.rs') 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(), + } +} -- cgit v1.2.3