feat: add Ellipsize to widgets

This commit is contained in:
Hojjat 2026-02-19 09:27:37 -07:00 • committed by Ashley Wulber
parent f2ef716ad5
commit cc670e1966
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
18 changed files with 181 additions and 9 deletions

View file

@ -112,6 +112,7 @@ pub struct Toggler<
text_alignment: text::Alignment,
text_shaping: text::Shaping,
text_wrapping: text::Wrapping,
text_ellipsize: text::Ellipsize,
spacing: f32,
font: Option<Renderer::Font>,
class: Theme::Class<'a>,
@ -150,6 +151,7 @@ where
text_line_height: text::LineHeight::default(),
text_alignment: text::Alignment::Default,
text_wrapping: text::Wrapping::default(),
text_ellipsize: text::Ellipsize::default(),
spacing: Self::DEFAULT_SIZE / 2.0,
text_shaping: text::Shaping::Advanced,
font: None,
@ -237,6 +239,12 @@ where
self
}
/// Sets the [`text::Ellipsize`] strategy of the [`Toggler`].
pub fn text_ellipsize(mut self, ellipsize: text::Ellipsize) -> Self {
self.text_ellipsize = ellipsize;
self
}
/// Sets the spacing between the [`Toggler`] and the text.
pub fn spacing(mut self, spacing: impl Into<Pixels>) -> Self {
self.spacing = spacing.into().0;
@ -362,6 +370,7 @@ where
align_y: alignment::Vertical::Top,
shaping: self.text_shaping,
wrapping: self.text_wrapping,
ellipsize: self.text_ellipsize,
},
)
} else {