style: apply dart format across project
This commit is contained in:
@@ -66,7 +66,7 @@ class CurrencyUtil {
|
||||
final locale = _getLocaleForCurrency(currency);
|
||||
final symbol = getCurrencySymbol(currency);
|
||||
final decimals = (currency == 'KRW' || currency == 'JPY') ? 0 : 2;
|
||||
|
||||
|
||||
return NumberFormat.currency(
|
||||
locale: locale,
|
||||
symbol: symbol,
|
||||
@@ -81,27 +81,29 @@ class CurrencyUtil {
|
||||
String locale,
|
||||
) async {
|
||||
final defaultCurrency = getDefaultCurrency(locale);
|
||||
|
||||
|
||||
// 입력 통화가 기본 통화인 경우
|
||||
if (currency == defaultCurrency) {
|
||||
return _formatSingleCurrency(amount, currency);
|
||||
}
|
||||
|
||||
|
||||
// USD 입력인 경우 - 기본 통화로 변환하여 표시
|
||||
if (currency == 'USD' && defaultCurrency != 'USD') {
|
||||
final convertedAmount = await _exchangeRateService.convertUsdToTarget(amount, defaultCurrency);
|
||||
final convertedAmount = await _exchangeRateService.convertUsdToTarget(
|
||||
amount, defaultCurrency);
|
||||
if (convertedAmount != null) {
|
||||
final primaryFormatted = _formatSingleCurrency(convertedAmount, defaultCurrency);
|
||||
final primaryFormatted =
|
||||
_formatSingleCurrency(convertedAmount, defaultCurrency);
|
||||
final usdFormatted = _formatSingleCurrency(amount, 'USD');
|
||||
return '$primaryFormatted ($usdFormatted)';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 영어 사용자가 KRW 선택한 경우
|
||||
if (locale == 'en' && currency == 'KRW') {
|
||||
return _formatSingleCurrency(amount, currency);
|
||||
}
|
||||
|
||||
|
||||
// 기타 통화 입력인 경우
|
||||
return _formatSingleCurrency(amount, currency);
|
||||
}
|
||||
@@ -116,13 +118,13 @@ class CurrencyUtil {
|
||||
|
||||
for (var subscription in subscriptions) {
|
||||
final price = subscription.currentPrice;
|
||||
|
||||
|
||||
final converted = await _exchangeRateService.convertBetweenCurrencies(
|
||||
price,
|
||||
subscription.currency,
|
||||
defaultCurrency,
|
||||
);
|
||||
|
||||
|
||||
total += converted ?? price;
|
||||
}
|
||||
|
||||
@@ -178,13 +180,13 @@ class CurrencyUtil {
|
||||
for (var subscription in subscriptions) {
|
||||
if (subscription.isCurrentlyInEvent) {
|
||||
final savings = subscription.eventSavings;
|
||||
|
||||
|
||||
final converted = await _exchangeRateService.convertBetweenCurrencies(
|
||||
savings,
|
||||
subscription.currency,
|
||||
defaultCurrency,
|
||||
);
|
||||
|
||||
|
||||
total += converted ?? savings;
|
||||
}
|
||||
}
|
||||
@@ -204,7 +206,7 @@ class CurrencyUtil {
|
||||
if (!subscription.isCurrentlyInEvent) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
final savings = subscription.eventSavings;
|
||||
return formatAmountWithLocale(savings, subscription.currency, locale);
|
||||
}
|
||||
@@ -225,4 +227,4 @@ class CurrencyUtil {
|
||||
static Future<String> formatAmount(double amount, String currency) async {
|
||||
return formatAmountWithCurrencyAndLocale(amount, currency, 'ko');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user