mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 12:29:31 +00:00
CWA-169 | created check_amount then added to transaction_info and to trade
This commit is contained in:
parent
7c83a71916
commit
ad241ca1db
4 changed files with 15 additions and 3 deletions
8
lib/src/domain/common/check_amount.dart
Normal file
8
lib/src/domain/common/check_amount.dart
Normal file
|
@ -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:cw_monero/structs/transaction_info_row.dart';
|
||||||
import 'package:cake_wallet/src/domain/common/parseBoolFromString.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/transaction_direction.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/common/check_amount.dart';
|
||||||
|
|
||||||
class TransactionInfo {
|
class TransactionInfo {
|
||||||
TransactionInfo(this.id, this.height, this.direction, this.date,
|
TransactionInfo(this.id, this.height, this.direction, this.date,
|
||||||
|
@ -40,9 +41,9 @@ class TransactionInfo {
|
||||||
|
|
||||||
String _fiatAmount;
|
String _fiatAmount;
|
||||||
|
|
||||||
String amountFormatted() => '${moneroAmountToString(amount: amount)} XMR';
|
String amountFormatted() => '${checkAmount(moneroAmountToString(amount: amount))} XMR';
|
||||||
|
|
||||||
String fiatAmount() => _fiatAmount ?? '';
|
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/common/crypto_currency.dart';
|
||||||
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.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/exchange/trade_state.dart';
|
||||||
|
import 'package:cake_wallet/src/domain/common/check_amount.dart';
|
||||||
|
|
||||||
part 'trade.g.dart';
|
part 'trade.g.dart';
|
||||||
|
|
||||||
|
@ -101,4 +102,6 @@ class Trade extends HiveObject {
|
||||||
'wallet_id': walletId
|
'wallet_id': walletId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String amountFormatted() => checkAmount(amount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,7 +577,7 @@ class DashboardPageBodyState extends State<DashboardPageBody> {
|
||||||
final formattedAmount = trade.amount != null
|
final formattedAmount = trade.amount != null
|
||||||
? savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
? savedDisplayMode == BalanceDisplayMode.hiddenBalance
|
||||||
? '---'
|
? '---'
|
||||||
: trade.amount
|
: trade.amountFormatted()
|
||||||
: trade.amount;
|
: trade.amount;
|
||||||
|
|
||||||
return TradeRow(
|
return TradeRow(
|
||||||
|
|
Loading…
Reference in a new issue