mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
CAKE-171 | fixed fiat amount displaying bug on transaction list; moved calculating price, type of fiat currency and display mode to transaction list item
This commit is contained in:
parent
65c2abdedc
commit
7bbc14d549
3 changed files with 19 additions and 15 deletions
|
@ -13,6 +13,6 @@ void startCurrentFiatChangeReaction(AppStore appStore, SettingsStore settingsSto
|
|||
(_) => settingsStore.fiatCurrency, (FiatCurrency fiatCurrency) async {
|
||||
final cryptoCurrency = appStore.wallet.currency;
|
||||
fiatConversionStore.price = await FiatConversionService.fetchPrice(
|
||||
cryptoCurrency, settingsStore.fiatCurrency);
|
||||
cryptoCurrency, fiatCurrency);
|
||||
});
|
||||
}
|
|
@ -78,9 +78,8 @@ abstract class DashboardViewModelBase with Store {
|
|||
.transactionHistory.transactions.values
|
||||
.map((transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
price: price,
|
||||
fiatCurrency: appStore.settingsStore.fiatCurrency,
|
||||
displayMode: balanceDisplayMode)));
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
|
||||
_reaction = reaction((_) => appStore.wallet, _onWalletChange);
|
||||
// FIXME: fixme
|
||||
|
@ -89,9 +88,8 @@ abstract class DashboardViewModelBase with Store {
|
|||
transactions,
|
||||
(TransactionInfo val) => TransactionListItem(
|
||||
transaction: val,
|
||||
price: price,
|
||||
fiatCurrency: appStore.settingsStore.fiatCurrency,
|
||||
displayMode: balanceDisplayMode));
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore));
|
||||
|
||||
final _wallet = wallet;
|
||||
|
||||
|
@ -185,8 +183,7 @@ abstract class DashboardViewModelBase with Store {
|
|||
transactions.addAll(wallet.transactionHistory.transactions.values.map(
|
||||
(transaction) => TransactionListItem(
|
||||
transaction: transaction,
|
||||
price: price,
|
||||
fiatCurrency: appStore.settingsStore.fiatCurrency,
|
||||
displayMode: balanceDisplayMode)));
|
||||
balanceViewModel: balanceViewModel,
|
||||
settingsStore: appStore.settingsStore)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||
import 'package:cake_wallet/entities/transaction_info.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/utils/mobx.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/action_list_item.dart';
|
||||
import 'package:cake_wallet/bitcoin/bitcoin_transaction_info.dart';
|
||||
|
@ -8,15 +9,21 @@ import 'package:cake_wallet/monero/monero_transaction_info.dart';
|
|||
import 'package:cake_wallet/monero/monero_amount_format.dart';
|
||||
import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart';
|
||||
import 'package:cake_wallet/entities/calculate_fiat_amount_raw.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
||||
|
||||
class TransactionListItem extends ActionListItem with Keyable {
|
||||
TransactionListItem(
|
||||
{this.transaction, this.price, this.fiatCurrency, this.displayMode});
|
||||
{this.transaction, this.balanceViewModel, this.settingsStore});
|
||||
|
||||
final TransactionInfo transaction;
|
||||
final double price;
|
||||
final FiatCurrency fiatCurrency;
|
||||
final BalanceDisplayMode displayMode;
|
||||
final BalanceViewModel balanceViewModel;
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
double get price => balanceViewModel.price;
|
||||
|
||||
FiatCurrency get fiatCurrency => settingsStore.fiatCurrency;
|
||||
|
||||
BalanceDisplayMode get displayMode => settingsStore.balanceDisplayMode;
|
||||
|
||||
@override
|
||||
dynamic get keyIndex => transaction.id;
|
||||
|
@ -49,4 +56,4 @@ class TransactionListItem extends ActionListItem with Keyable {
|
|||
|
||||
@override
|
||||
DateTime get date => transaction.date;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue