From a1d4112532a41c32ad3ef4d301f1603ae73c50ab Mon Sep 17 00:00:00 2001 From: pml68 Date: Thu, 17 Apr 2025 00:39:06 +0200 Subject: feat(material_theme): implement `progress_bar::Catalog` --- crates/material_theme/src/lib.rs | 1 + crates/material_theme/src/progress_bar.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 crates/material_theme/src/progress_bar.rs (limited to 'crates/material_theme/src') diff --git a/crates/material_theme/src/lib.rs b/crates/material_theme/src/lib.rs index 64e71d3..a68f0ae 100644 --- a/crates/material_theme/src/lib.rs +++ b/crates/material_theme/src/lib.rs @@ -14,6 +14,7 @@ pub mod dialog; pub mod markdown; pub mod menu; pub mod pick_list; +pub mod progress_bar; #[cfg(feature = "qr_code")] pub mod qr_code; pub mod scrollable; diff --git a/crates/material_theme/src/progress_bar.rs b/crates/material_theme/src/progress_bar.rs new file mode 100644 index 0000000..f686fff --- /dev/null +++ b/crates/material_theme/src/progress_bar.rs @@ -0,0 +1,26 @@ +use iced_widget::core::{Background, border}; +use iced_widget::progress_bar::{Catalog, Style, StyleFn}; + +use super::Theme; + +impl Catalog for Theme { + type Class<'a> = StyleFn<'a, Self>; + + fn default<'a>() -> Self::Class<'a> { + Box::new(default) + } + + fn style(&self, class: &Self::Class<'_>) -> Style { + class(self) + } +} + +pub fn default(theme: &Theme) -> Style { + Style { + background: Background::Color( + theme.colorscheme.secondary.secondary_container, + ), + bar: Background::Color(theme.colorscheme.primary.color), + border: border::rounded(400), + } +} -- cgit v1.2.3