diff --git a/lib/reactions/on_current_fiat_change.dart b/lib/reactions/on_current_fiat_change.dart index 794323dc5..28c6f621c 100644 --- a/lib/reactions/on_current_fiat_change.dart +++ b/lib/reactions/on_current_fiat_change.dart @@ -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); }); } \ No newline at end of file diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 500c9fb92..e76a663ec 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -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))); } } diff --git a/lib/view_model/dashboard/transaction_list_item.dart b/lib/view_model/dashboard/transaction_list_item.dart index 909f22472..83477544e 100644 --- a/lib/view_model/dashboard/transaction_list_item.dart +++ b/lib/view_model/dashboard/transaction_list_item.dart @@ -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; -} +} \ No newline at end of file