fix(segmented_button): update text on font changes

This commit is contained in:
Michael Aaron Murphy 2024-10-10 18:52:18 +02:00
parent c6589e0165
commit 9f11239ea5
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -620,8 +620,10 @@ where
(self.font_inactive, 2)
};
let font = font.unwrap_or_else(crate::font::default);
let mut hasher = DefaultHasher::new();
text.hash(&mut hasher);
font.hash(&mut hasher);
button_state.hash(&mut hasher);
let text_hash = hasher.finish();
@ -635,7 +637,7 @@ where
content: text,
size: iced::Pixels(self.font_size),
bounds: Size::INFINITY,
font: font.unwrap_or_else(crate::font::default),
font,
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Center,
shaping: Shaping::Advanced,