diff options
| author | Joe Carstairs <me@joeac.net> | 2026-02-12 20:00:26 +0000 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-02-12 20:00:26 +0000 |
| commit | 413afad1fdf1d15fefc1b709f2eba1332a110608 (patch) | |
| tree | d11385e53035a1d517154f25c72cd64ca9815d1e /schist_desktop_gui/src/gui/components/text.rs | |
| parent | b3f91aef7c9673c180690f6e22984d50e0dbeecf (diff) | |
task-085: uses new iced::widget::Table instead of home-made widget
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, |
