aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-05-26 22:56:10 +0200
committerpml68 <contact@pml68.dev>2025-05-26 22:56:10 +0200
commit5f32046ee9dc74f167912b09aaf2ec6b6aa53c1c (patch)
tree05e74f9330d7b3e3b6c806b07b8198f9b9461a63
parentfeat: add example code to documentation and README (diff)
downloadiced_dialog-5f32046ee9dc74f167912b09aaf2ec6b6aa53c1c.tar.gz
feat: switch from `String` to `Fragment` for `title`
-rw-r--r--src/dialog.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dialog.rs b/src/dialog.rs
index 550fa5a..74dea5a 100644
--- a/src/dialog.rs
+++ b/src/dialog.rs
@@ -6,7 +6,9 @@ use iced_core::{
};
use iced_widget::{
Column, Container, Row, Theme, center, container, mouse_area, opaque,
- stack, text, vertical_space,
+ stack, text,
+ text::{Fragment, IntoFragment},
+ vertical_space,
};
/// A message dialog.
@@ -26,7 +28,7 @@ pub struct Dialog<
{
is_open: bool,
base: Element<'a, Message, Theme, Renderer>,
- title: Option<String>,
+ title: Option<Fragment<'a>>,
content: Element<'a, Message, Theme, Renderer>,
buttons: Vec<Element<'a, Message, Theme, Renderer>>,
font: Option<Renderer::Font>,
@@ -81,8 +83,8 @@ where
}
/// Sets the [`Dialog`]'s title.
- pub fn title(mut self, title: impl Into<String>) -> Self {
- self.title = Some(title.into());
+ pub fn title(mut self, title: impl IntoFragment<'a>) -> Self {
+ self.title = Some(title.into_fragment());
self
}