Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ class WalletSummaryInfo extends ConsumerWidget {
final Amount balanceToShow;
final String title;

final bool toggleBalance;
final bool useSimpleToggle;
final bool hasMultipleBalances;

if (coin is Firo) {
toggleBalance = false;
useSimpleToggle = false;
hasMultipleBalances = true; // Firo always has multiple balance types.
final type = ref.watch(publicPrivateBalanceStateProvider.state).state;
title =
"${_showAvailable ? "Available" : "Full"} ${type.name.capitalize()} balance";
Expand All @@ -111,7 +113,9 @@ class WalletSummaryInfo extends ConsumerWidget {
break;
}
} else {
toggleBalance = true;
useSimpleToggle = true;
// Update hasMultipleBalances based on if all of the balances are equal.
hasMultipleBalances = balance.spendable != balance.total;
balanceToShow = _showAvailable ? balance.spendable : balance.total;
title = _showAvailable ? "Available balance" : "Full balance";
}
Expand Down Expand Up @@ -144,7 +148,7 @@ class WalletSummaryInfo extends ConsumerWidget {
children: [
GestureDetector(
onTap: () {
if (toggleBalance) {
if (useSimpleToggle) {
if (ref.read(walletBalanceToggleStateProvider) ==
WalletBalanceToggleState.available) {
ref
Expand All @@ -169,7 +173,7 @@ class WalletSummaryInfo extends ConsumerWidget {
.textFavoriteCard,
),
),
if (!toggleBalance) ...[
if (hasMultipleBalances) ...[
const SizedBox(
width: 4,
),
Expand Down