diff options
| author | pml68 <contact@pml68.dev> | 2025-04-15 01:44:00 +0200 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-04-15 23:53:07 +0200 |
| commit | de43465ddb50dd6b0c44d8de7a05aa16ba38d312 (patch) | |
| tree | 14204074c61c29edfb6c877f25cb4f3094e112db | |
| parent | feat(PKGBUILD): update pkgver fn, dependencies (diff) | |
| download | iced-builder-de43465ddb50dd6b0c44d8de7a05aa16ba38d312.tar.gz | |
chore(deps): update `iced_dialog`
| -rw-r--r-- | Cargo.lock | 18 | ||||
| -rw-r--r-- | crates/material_theme/src/dialog.rs | 30 | ||||
| -rw-r--r-- | src/dialogs.rs | 4 | ||||
| -rw-r--r-- | theme_test/src/main.rs | 7 |
4 files changed, 36 insertions, 23 deletions
@@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "arbitrary" @@ -860,9 +860,9 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db686e755000c93f73a3acc78be56a71e3efb83ed92886f45faea2b9485bad7" +checksum = "da46a9d5a8905cc538a4a5bceb6a4510de7a51049c5588c0114efce102bcbbe8" dependencies = [ "bitflags 2.9.0", "fontdb 0.16.2", @@ -1733,9 +1733,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" +checksum = "75249d144030531f8dee69fe9cea04d3edf809a017ae445e2abdff6629e86633" dependencies = [ "atomic-waker", "bytes", @@ -2054,7 +2054,7 @@ dependencies = [ [[package]] name = "iced_dialog" version = "0.14.0-dev" -source = "git+https://github.com/pml68/iced_dialog?branch=iced%2Fpersonal#c0f931f38ac83e77cfb937d4166fa8d2a23988cf" +source = "git+https://github.com/pml68/iced_dialog?branch=iced%2Fpersonal#a41468011f8e4f566e9301565f3276fb10cc9551" dependencies = [ "iced_core", "iced_widget", @@ -3778,9 +3778,9 @@ dependencies = [ [[package]] name = "ravif" -version = "0.11.11" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" +checksum = "d6a5f31fcf7500f9401fea858ea4ab5525c99f2322cfcee732c0e6c74208c0c6" dependencies = [ "avif-serialize", "imgref", diff --git a/crates/material_theme/src/dialog.rs b/crates/material_theme/src/dialog.rs index 68c61b5..a022548 100644 --- a/crates/material_theme/src/dialog.rs +++ b/crates/material_theme/src/dialog.rs @@ -1,25 +1,41 @@ -use iced_widget::container::Style; +use iced_dialog::dialog::{Catalog, Style, StyleFn}; +use iced_widget::container; use iced_widget::core::{Background, border}; use super::{Theme, text}; -impl iced_dialog::dialog::Catalog for Theme { - fn default_container<'a>() - -> <Self as iced_widget::container::Catalog>::Class<'a> { +impl Catalog for Theme { + type Class<'a> = StyleFn<'a, Self>; + + fn default<'a>() -> <Self as Catalog>::Class<'a> { + Box::new(default) + } + + fn default_container<'a>() -> <Self as container::Catalog>::Class<'a> { Box::new(default_container) } fn default_title<'a>() -> <Self as iced_widget::text::Catalog>::Class<'a> { Box::new(text::surface) } + + fn style(&self, class: &<Self as Catalog>::Class<'_>) -> Style { + class(self) + } } -pub fn default_container(theme: &Theme) -> Style { +pub fn default_container(theme: &Theme) -> container::Style { let colors = theme.colorscheme.surface; - Style { + container::Style { background: Some(Background::Color(colors.surface_container.high)), text_color: Some(colors.on_surface_variant), border: border::rounded(28), - ..Style::default() + ..container::Style::default() + } +} + +pub fn default(theme: &Theme) -> Style { + Style { + backdrop_color: theme.colorscheme.scrim, } } diff --git a/src/dialogs.rs b/src/dialogs.rs index 08513fd..a623f35 100644 --- a/src/dialogs.rs +++ b/src/dialogs.rs @@ -9,11 +9,11 @@ pub const WARNING_TITLE: &str = "Heads up!"; pub const ERROR_TITLE: &str = "Oops! Something went wrong."; pub fn ok_button<'a>() -> Element<'a, Message> { - button("Ok").on_press(Message::DialogOk).into() + button("Ok", Message::DialogOk).into() } pub fn cancel_button<'a>() -> Element<'a, Message> { - button("Cancel").on_press(Message::DialogCancel).into() + button("Cancel", Message::DialogCancel).into() } pub fn error_dialog(description: impl Into<String>) -> Task<Message> { diff --git a/theme_test/src/main.rs b/theme_test/src/main.rs index 9826fe9..bcf16de 100644 --- a/theme_test/src/main.rs +++ b/theme_test/src/main.rs @@ -126,12 +126,9 @@ impl State { let dialog = dialog(self.show_dialog, base, iced::widget::text("Say Hi!")) .title("This is a Dialog.") - .push_button( - iced_dialog::button("Hi!").on_press(Message::CloseDialog), - ) - .backdrop(|theme| theme.colorscheme.scrim) + .push_button(iced_dialog::button("Hi!", Message::CloseDialog)) .width(280) - .height(187); + .height(186); Animation::new(&self.theme, dialog) .on_update(Message::SwitchTheme) |
