diff options
| author | pml68 <contact@pml68.dev> | 2025-05-03 11:20:18 +0200 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-05-03 11:20:18 +0200 |
| commit | 425b4817f3288b5da42b180c3ab4901034a773d5 (patch) | |
| tree | ce8c244f2aff7e0365e4cfc0ac6a2c765e942402 | |
| parent | feat: set defaults for `Dialog`'s `Theme` and `Renderer` type parameters (diff) | |
| download | iced_dialog-425b4817f3288b5da42b180c3ab4901034a773d5.tar.gz | |
feat: add `backdrop` method to `Dialog`
| -rw-r--r-- | src/dialog.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dialog.rs b/src/dialog.rs index 8cba533..550fa5a 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -153,6 +153,16 @@ where buttons.into_iter().fold(self, Self::push_button) } + /// Sets the backdrop color of the [`Dialog`]. + pub fn backdrop(self, color: impl Into<Color>) -> Self + where + <Theme as Catalog>::Class<'a>: From<StyleFn<'a, Theme>>, + { + let backdrop_color = color.into(); + + self.style(move |_theme| Style { backdrop_color }) + } + /// Sets the style of the [`Dialog`]. #[must_use] pub fn style(mut self, style: impl Fn(&Theme) -> Style + 'a) -> Self |
