diff options
| author | pml68 <contact@pml68.dev> | 2025-04-19 01:10:11 +0200 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-04-19 01:10:11 +0200 |
| commit | 6300486b8ea51b75850708acb271fcce02666dd6 (patch) | |
| tree | cabfc1ce7bdfcbacb76df8c49e4c23b4a13199d5 /crates/material_theme | |
| parent | feat(material_theme): implement `slider::Catalog` (diff) | |
| download | iced-builder-6300486b8ea51b75850708acb271fcce02666dd6.tar.gz | |
feat(material_theme): implement `rule::Catalog`
Diffstat (limited to '')
| -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(), + } +} |
