mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-18 16:55:58 +00:00
move view model into di.dart
This commit is contained in:
parent
5960c390a4
commit
f85ec0631b
2 changed files with 6 additions and 3 deletions
|
@ -746,6 +746,7 @@ Future<void> setup({
|
||||||
_transactionDescriptionBox,
|
_transactionDescriptionBox,
|
||||||
getIt.get<AppStore>().wallet!.isHardwareWallet ? getIt.get<LedgerViewModel>() : null,
|
getIt.get<AppStore>().wallet!.isHardwareWallet ? getIt.get<LedgerViewModel>() : null,
|
||||||
coinTypeToSpendFrom: coinTypeToSpendFrom ?? UnspentCoinType.any,
|
coinTypeToSpendFrom: coinTypeToSpendFrom ?? UnspentCoinType.any,
|
||||||
|
getIt.get<UnspentCoinsListViewModel>(param1: coinTypeToSpendFrom),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
wallet.type == WalletType.tron;
|
wallet.type == WalletType.tron;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UnspentCoinsListViewModel unspentCoinsListViewModel;
|
||||||
|
|
||||||
SendViewModelBase(
|
SendViewModelBase(
|
||||||
AppStore appStore,
|
AppStore appStore,
|
||||||
this.sendTemplateViewModel,
|
this.sendTemplateViewModel,
|
||||||
|
@ -72,7 +74,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
this.balanceViewModel,
|
this.balanceViewModel,
|
||||||
this.contactListViewModel,
|
this.contactListViewModel,
|
||||||
this.transactionDescriptionBox,
|
this.transactionDescriptionBox,
|
||||||
this.ledgerViewModel, {
|
this.ledgerViewModel,
|
||||||
|
this.unspentCoinsListViewModel, {
|
||||||
this.coinTypeToSpendFrom = UnspentCoinType.any,
|
this.coinTypeToSpendFrom = UnspentCoinType.any,
|
||||||
}) : state = InitialExecutionState(),
|
}) : state = InitialExecutionState(),
|
||||||
currencies = appStore.wallet!.balance.keys.toList(),
|
currencies = appStore.wallet!.balance.keys.toList(),
|
||||||
|
@ -532,9 +535,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasCoinControl) {
|
if (hasCoinControl) {
|
||||||
final vm = getIt.get<UnspentCoinsListViewModel>(param1: coinTypeToSpendFrom);
|
|
||||||
bool isCoinSelected = false;
|
bool isCoinSelected = false;
|
||||||
for (var coin in vm.items) {
|
for (var coin in unspentCoinsListViewModel.items) {
|
||||||
isCoinSelected = isCoinSelected || (coin.isSending && !coin.isFrozen);
|
isCoinSelected = isCoinSelected || (coin.isSending && !coin.isFrozen);
|
||||||
}
|
}
|
||||||
if (!isCoinSelected) {
|
if (!isCoinSelected) {
|
||||||
|
|
Loading…
Reference in a new issue