Euro Sign is randomly left or right in the Client Table #174
This commit is contained in:
parent
20b48f92ad
commit
2f0ed79aa2
|
|
@ -109,8 +109,14 @@ String formatNumber(
|
||||||
}
|
}
|
||||||
|
|
||||||
final CurrencyEntity currency = state.staticState.currencyMap[currencyId];
|
final CurrencyEntity currency = state.staticState.currencyMap[currencyId];
|
||||||
|
final CurrencyEntity companyCurrency =
|
||||||
|
state.staticState.currencyMap[company.currencyId];
|
||||||
|
|
||||||
final CountryEntity country =
|
final CountryEntity country =
|
||||||
state.staticState.countryMap[countryId] ?? CountryEntity();
|
state.staticState.countryMap[countryId] ?? CountryEntity();
|
||||||
|
final CountryEntity companyCountry =
|
||||||
|
state.staticState.countryMap[company.settings.countryId] ??
|
||||||
|
CountryEntity();
|
||||||
|
|
||||||
if (currency == null) {
|
if (currency == null) {
|
||||||
return '';
|
return '';
|
||||||
|
|
@ -122,10 +128,10 @@ String formatNumber(
|
||||||
|
|
||||||
String thousandSeparator = currency.thousandSeparator;
|
String thousandSeparator = currency.thousandSeparator;
|
||||||
String decimalSeparator = currency.decimalSeparator;
|
String decimalSeparator = currency.decimalSeparator;
|
||||||
bool swapCurrencySymbol = currency.swapCurrencySymbol;
|
bool swapCurrencySymbol = companyCurrency.swapCurrencySymbol;
|
||||||
|
|
||||||
if (currency.id == kCurrencyEuro) {
|
if (currency.id == kCurrencyEuro) {
|
||||||
swapCurrencySymbol = country.swapCurrencySymbol;
|
swapCurrencySymbol = companyCountry.swapCurrencySymbol;
|
||||||
if (country.thousandSeparator != null &&
|
if (country.thousandSeparator != null &&
|
||||||
country.thousandSeparator.isNotEmpty) {
|
country.thousandSeparator.isNotEmpty) {
|
||||||
thousandSeparator = country.thousandSeparator;
|
thousandSeparator = country.thousandSeparator;
|
||||||
|
|
@ -195,12 +201,13 @@ String formatNumber(
|
||||||
} else if ((showCurrencyCode ?? company.settings.showCurrencyCode ?? false) ||
|
} else if ((showCurrencyCode ?? company.settings.showCurrencyCode ?? false) ||
|
||||||
currency.symbol.isEmpty) {
|
currency.symbol.isEmpty) {
|
||||||
return '$formatted ${currency.code}';
|
return '$formatted ${currency.code}';
|
||||||
} else if (swapCurrencySymbol) {
|
|
||||||
return '$formatted ${currency.symbol.trim()}';
|
|
||||||
} else if (value < 0) {
|
|
||||||
return '−${currency.symbol}$formatted';
|
|
||||||
} else {
|
} else {
|
||||||
return '${currency.symbol}$formatted';
|
final prefix = value < 0 ? '-' : '';
|
||||||
|
if (swapCurrencySymbol) {
|
||||||
|
return '$prefix$formatted ${currency.symbol.trim()}';
|
||||||
|
} else {
|
||||||
|
return '$prefix${currency.symbol}$formatted';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue