mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
CWA-169 | created check_amount then added to transaction_info and to trade
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
String checkAmount(String amount) {
|
||||
if (!amount.contains('.')) {
|
||||
return amount + '.00';
|
||||
} else if (amount.endsWith('.')) {
|
||||
return amount + '00';
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'package:cake_wallet/src/domain/monero/monero_amount_format.dart';
|
||||
import 'package:cw_monero/structs/transaction_info_row.dart';
|
||||
import 'package:cake_wallet/src/domain/common/parseBoolFromString.dart';
|
||||
import 'package:cake_wallet/src/domain/common/transaction_direction.dart';
|
||||
import 'package:cake_wallet/src/domain/common/check_amount.dart';
|
||||
|
||||
class TransactionInfo {
|
||||
TransactionInfo(this.id, this.height, this.direction, this.date,
|
||||
@@ -40,9 +41,9 @@ class TransactionInfo {
|
||||
|
||||
String _fiatAmount;
|
||||
|
||||
String amountFormatted() => '${moneroAmountToString(amount: amount)} XMR';
|
||||
String amountFormatted() => '${checkAmount(moneroAmountToString(amount: amount))} XMR';
|
||||
|
||||
String fiatAmount() => _fiatAmount ?? '';
|
||||
|
||||
void changeFiatAmount(String amount) => _fiatAmount = amount;
|
||||
void changeFiatAmount(String amount) => _fiatAmount = checkAmount(amount);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:hive/hive.dart';
|
||||
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/src/domain/exchange/trade_state.dart';
|
||||
import 'package:cake_wallet/src/domain/common/check_amount.dart';
|
||||
|
||||
part 'trade.g.dart';
|
||||
|
||||
@@ -101,4 +102,6 @@ class Trade extends HiveObject {
|
||||
'wallet_id': walletId
|
||||
};
|
||||
}
|
||||
|
||||
String amountFormatted() => checkAmount(amount);
|
||||
}
|
||||
|
||||
@@ -577,7 +577,7 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
|
||||
final formattedAmount = trade.amount != null
|
||||
? savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
||||
? '---'
|
||||
: trade.amount
|
||||
: trade.amountFormatted()
|
||||
: trade.amount;
|
||||
|
||||
return TradeRow(
|
||||
|
||||
Reference in New Issue
Block a user