mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-05-02 19:02:17 +00:00
only affect firo wallets
This commit is contained in:
parent
005fcdf44f
commit
a69cc80e61
1 changed files with 10 additions and 25 deletions
|
@ -45,26 +45,8 @@ class WalletSummaryInfo extends ConsumerWidget {
|
||||||
final String walletId;
|
final String walletId;
|
||||||
final WalletSyncStatus initialSyncStatus;
|
final WalletSyncStatus initialSyncStatus;
|
||||||
|
|
||||||
void showSheet(BuildContext context, WidgetRef ref) {
|
void showSheet(
|
||||||
final wallet =
|
BuildContext context, WidgetRef ref, List<FiroType> availableBalances) {
|
||||||
ref.watch(pWallets.select((value) => value.getWallet(walletId)));
|
|
||||||
final firoWallet = wallet as FiroWallet;
|
|
||||||
final availableBalances = getAvailableBalances(firoWallet);
|
|
||||||
|
|
||||||
// Remove any elements whose balance is zero.
|
|
||||||
availableBalances.removeWhere((element) {
|
|
||||||
switch (element) {
|
|
||||||
case FiroType.spark:
|
|
||||||
return firoWallet.info.cachedBalanceTertiary.spendable.raw ==
|
|
||||||
BigInt.zero;
|
|
||||||
case FiroType.lelantus:
|
|
||||||
return firoWallet.info.cachedBalanceSecondary.spendable.raw ==
|
|
||||||
BigInt.zero;
|
|
||||||
case FiroType.public:
|
|
||||||
return firoWallet.info.cachedBalance.spendable.raw == BigInt.zero;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (availableBalances.length <= 2) {
|
if (availableBalances.length <= 2) {
|
||||||
final state = ref.read(publicPrivateBalanceStateProvider.state).state;
|
final state = ref.read(publicPrivateBalanceStateProvider.state).state;
|
||||||
final newState = availableBalances.firstWhere(
|
final newState = availableBalances.firstWhere(
|
||||||
|
@ -111,6 +93,8 @@ class WalletSummaryInfo extends ConsumerWidget {
|
||||||
);
|
);
|
||||||
final coin = ref.watch(pWalletCoin(walletId));
|
final coin = ref.watch(pWalletCoin(walletId));
|
||||||
final balance = ref.watch(pWalletBalance(walletId));
|
final balance = ref.watch(pWalletBalance(walletId));
|
||||||
|
final wallet =
|
||||||
|
ref.watch(pWallets.select((value) => value.getWallet(walletId)));
|
||||||
|
|
||||||
final locale = ref.watch(
|
final locale = ref.watch(
|
||||||
localeServiceChangeNotifierProvider.select((value) => value.locale),
|
localeServiceChangeNotifierProvider.select((value) => value.locale),
|
||||||
|
@ -129,8 +113,6 @@ class WalletSummaryInfo extends ConsumerWidget {
|
||||||
|
|
||||||
final Amount balanceToShow;
|
final Amount balanceToShow;
|
||||||
final String title;
|
final String title;
|
||||||
final wallet =
|
|
||||||
ref.watch(pWallets.select((value) => value.getWallet(walletId)));
|
|
||||||
List<FiroType> availableBalances = [];
|
List<FiroType> availableBalances = [];
|
||||||
|
|
||||||
if (wallet is FiroWallet) {
|
if (wallet is FiroWallet) {
|
||||||
|
@ -187,9 +169,12 @@ class WalletSummaryInfo extends ConsumerWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: availableBalances.length > 1
|
onTap: () {
|
||||||
? () => showSheet(context, ref)
|
if (availableBalances.isNotEmpty &&
|
||||||
: null,
|
availableBalances.length > 1) {
|
||||||
|
showSheet(context, ref, availableBalances);
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
|
|
Loading…
Reference in a new issue