don't show lelantus balance on mobile if zero

This commit is contained in:
julian 2024-05-08 13:26:51 -06:00
parent bf14dd09f4
commit d8f6ff23d4
2 changed files with 89 additions and 78 deletions

View file

@ -173,16 +173,22 @@ class _FiroBalanceSelectionSheetState
),
),
),
if (firoWallet.info.cachedBalanceSecondary.spendable.raw >
BigInt.zero)
const SizedBox(
height: 16,
),
if (firoWallet.info.cachedBalanceSecondary.spendable.raw >
BigInt.zero)
GestureDetector(
onTap: () {
final state =
ref.read(publicPrivateBalanceStateProvider.state).state;
final state = ref
.read(publicPrivateBalanceStateProvider.state)
.state;
if (state != FiroType.lelantus) {
ref.read(publicPrivateBalanceStateProvider.state).state =
FiroType.lelantus;
ref
.read(publicPrivateBalanceStateProvider.state)
.state = FiroType.lelantus;
}
Navigator.of(context).pop();
},
@ -203,8 +209,8 @@ class _FiroBalanceSelectionSheetState
.radioButtonIconEnabled,
value: FiroType.lelantus,
groupValue: ref
.watch(
publicPrivateBalanceStateProvider.state)
.watch(publicPrivateBalanceStateProvider
.state)
.state,
onChanged: (x) {
ref

View file

@ -33,9 +33,9 @@ enum _BalanceType {
class WalletBalanceToggleSheet extends ConsumerWidget {
const WalletBalanceToggleSheet({
Key? key,
super.key,
required this.walletId,
}) : super(key: key);
});
final String walletId;
@ -46,7 +46,7 @@ class WalletBalanceToggleSheet extends ConsumerWidget {
final coin = ref.watch(pWalletCoin(walletId));
final isFiro = coin == Coin.firo || coin == Coin.firoTestNet;
Balance balance = ref.watch(pWalletBalance(walletId));
final balance = ref.watch(pWalletBalance(walletId));
_BalanceType _bal =
ref.watch(walletBalanceToggleStateProvider.state).state ==
@ -77,6 +77,11 @@ class WalletBalanceToggleSheet extends ConsumerWidget {
// already set above
break;
}
// hack to not show lelantus balance in ui if zero
if (balanceSecondary?.spendable.raw == BigInt.zero) {
balanceSecondary = null;
}
}
return Container(
@ -289,7 +294,7 @@ class WalletBalanceToggleSheet extends ConsumerWidget {
class BalanceSelector<T> extends ConsumerWidget {
const BalanceSelector({
Key? key,
super.key,
required this.title,
required this.coin,
required this.balance,
@ -297,7 +302,7 @@ class BalanceSelector<T> extends ConsumerWidget {
required this.onChanged,
required this.value,
required this.groupValue,
}) : super(key: key);
});
final String title;
final Coin coin;