From 251b7ad1d050f8aa42d48941f74acb604cd90ce1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 8 Feb 2021 09:00:06 +0200 Subject: [PATCH] Correct negative amount display --- lib/utils/formatting.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/utils/formatting.dart b/lib/utils/formatting.dart index 529331b33..ba5878600 100644 --- a/lib/utils/formatting.dart +++ b/lib/utils/formatting.dart @@ -196,13 +196,14 @@ String formatNumber( formatted = formatter.format(value < 0 ? value * -1 : value); } + final prefix = value < 0 ? '-' : ''; + if (formatNumberType == FormatNumberType.percent) { return '$formatted%'; } else if ((showCurrencyCode ?? company.settings.showCurrencyCode ?? false) || currency.symbol.isEmpty) { - return '$formatted ${currency.code}'; + return '$prefix$formatted ${currency.code}'; } else { - final prefix = value < 0 ? '-' : ''; if (swapCurrencySymbol) { return '$prefix$formatted ${currency.symbol.trim()}'; } else {