diff options
Diffstat (limited to 'schist_desktop_gui/src/gui/components/text.rs')
| -rw-r--r-- | schist_desktop_gui/src/gui/components/text.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/gui/components/text.rs b/schist_desktop_gui/src/gui/components/text.rs index 7a685c1..1760f4c 100644 --- a/schist_desktop_gui/src/gui/components/text.rs +++ b/schist_desktop_gui/src/gui/components/text.rs @@ -75,6 +75,15 @@ impl Text { } } + pub fn currency(amount: i32) -> Self { + let formatted_string = if amount < 0 { + format!("({} · {})", -amount / 100, -amount % 100) + } else { + format!(" {} · {} ", amount / 100, amount % 100) + }; + Self::default(&formatted_string) + } + pub fn as_element<'a, Message>(self) -> iced::Element<'a, Message> where Message: 'a, |
