Correct negative amount display

This commit is contained in:
Hillel Coren 2021-02-08 09:00:06 +02:00
parent 6f045918d9
commit 251b7ad1d0
1 changed files with 3 additions and 2 deletions

View File

@ -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 {