Hide available balance in send card (#2662)

* hide available balance on send page when balance is hidden

* hide available balance on send page when balance is hidden

* allow show/hide of balance from send card
This commit is contained in:
malik1004x
2025-11-21 22:15:30 +01:00
committed by GitHub
parent f05d6ef1b2
commit 7172928e1e
30 changed files with 62 additions and 9 deletions
+31 -7
View File
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:cake_wallet/core/open_crypto_pay/open_cryptopay_service.dart';
import 'package:cake_wallet/entities/balance_display_mode.dart';
import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart';
import 'package:cake_wallet/src/widgets/bottom_sheet/payment_confirmation_bottom_sheet.dart';
@@ -536,13 +537,36 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
FutureBuilder<String>(
future: sendViewModel.sendingBalance,
builder: (context, snapshot) {
return Text(
snapshot.data ??
sendViewModel.balance, // default to balance while loading
style: Theme.of(context).textTheme.bodySmall!.copyWith(
fontWeight: FontWeight.w600,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
return GestureDetector(
onTap: () {
sendViewModel.balanceViewModel
.switchBalanceValue();
},
child: Observer(builder: (_) {
final hidden = sendViewModel
.balanceViewModel.displayMode ==
BalanceDisplayMode.hiddenBalance;
return Text(
hidden
? S.of(context).show_balance_send_page
: (snapshot.data ??
sendViewModel.balance),
// default to balance while loading
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
fontWeight: FontWeight.w600,
color: hidden
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme
.onSurfaceVariant,
),
);
}),
);
},
)