mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-05-03 19:32:40 +00:00
disable send all for eth + tokens
This commit is contained in:
parent
d4cba56e81
commit
521a9bb0a3
2 changed files with 98 additions and 95 deletions
lib/pages/send_view
|
@ -364,7 +364,8 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
final coinControlEnabled =
|
final coinControlEnabled =
|
||||||
ref.read(prefsChangeNotifierProvider).enableCoinControl;
|
ref.read(prefsChangeNotifierProvider).enableCoinControl;
|
||||||
|
|
||||||
if (!(manager.hasCoinControlSupport && coinControlEnabled) ||
|
if (coin != Coin.ethereum &&
|
||||||
|
!(manager.hasCoinControlSupport && coinControlEnabled) ||
|
||||||
(manager.hasCoinControlSupport &&
|
(manager.hasCoinControlSupport &&
|
||||||
coinControlEnabled &&
|
coinControlEnabled &&
|
||||||
selectedUTXOs.isEmpty)) {
|
selectedUTXOs.isEmpty)) {
|
||||||
|
@ -1395,43 +1396,45 @@ class _SendViewState extends ConsumerState<SendView> {
|
||||||
style: STextStyles.smallMed12(context),
|
style: STextStyles.smallMed12(context),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
CustomTextButton(
|
if (coin != Coin.ethereum)
|
||||||
text: "Send all ${coin.ticker}",
|
CustomTextButton(
|
||||||
onTap: () async {
|
text: "Send all ${coin.ticker}",
|
||||||
if (coin == Coin.firo ||
|
onTap: () async {
|
||||||
coin == Coin.firoTestNet) {
|
if (coin == Coin.firo ||
|
||||||
final firoWallet =
|
coin == Coin.firoTestNet) {
|
||||||
ref.read(provider).wallet as FiroWallet;
|
final firoWallet = ref
|
||||||
if (ref
|
.read(provider)
|
||||||
.read(
|
.wallet as FiroWallet;
|
||||||
publicPrivateBalanceStateProvider
|
if (ref
|
||||||
.state)
|
.read(
|
||||||
.state ==
|
publicPrivateBalanceStateProvider
|
||||||
"Private") {
|
.state)
|
||||||
cryptoAmountController.text = firoWallet
|
.state ==
|
||||||
.availablePrivateBalance()
|
"Private") {
|
||||||
.toStringAsFixed(
|
cryptoAmountController.text = firoWallet
|
||||||
Constants.decimalPlacesForCoin(
|
.availablePrivateBalance()
|
||||||
coin));
|
.toStringAsFixed(
|
||||||
|
Constants.decimalPlacesForCoin(
|
||||||
|
coin));
|
||||||
|
} else {
|
||||||
|
cryptoAmountController.text = firoWallet
|
||||||
|
.availablePublicBalance()
|
||||||
|
.toStringAsFixed(
|
||||||
|
Constants.decimalPlacesForCoin(
|
||||||
|
coin));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cryptoAmountController.text = firoWallet
|
cryptoAmountController.text = (ref
|
||||||
.availablePublicBalance()
|
.read(provider)
|
||||||
|
.balance
|
||||||
|
.getSpendable())
|
||||||
.toStringAsFixed(
|
.toStringAsFixed(
|
||||||
Constants.decimalPlacesForCoin(
|
Constants.decimalPlacesForCoin(
|
||||||
coin));
|
coin));
|
||||||
}
|
}
|
||||||
} else {
|
_cryptoAmountChanged();
|
||||||
cryptoAmountController.text = (ref
|
},
|
||||||
.read(provider)
|
),
|
||||||
.balance
|
|
||||||
.getSpendable())
|
|
||||||
.toStringAsFixed(
|
|
||||||
Constants.decimalPlacesForCoin(
|
|
||||||
coin));
|
|
||||||
}
|
|
||||||
_cryptoAmountChanged();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
|
@ -402,56 +402,56 @@ class _TokenSendViewState extends ConsumerState<TokenSendView> {
|
||||||
fractionDigits: tokenContract.decimals,
|
fractionDigits: tokenContract.decimals,
|
||||||
);
|
);
|
||||||
|
|
||||||
// confirm send all
|
// // confirm send all
|
||||||
if (amount == availableBalance) {
|
// if (amount == availableBalance) {
|
||||||
bool? shouldSendAll;
|
// bool? shouldSendAll;
|
||||||
if (mounted) {
|
// if (mounted) {
|
||||||
shouldSendAll = await showDialog<bool>(
|
// shouldSendAll = await showDialog<bool>(
|
||||||
context: context,
|
// context: context,
|
||||||
useSafeArea: false,
|
// useSafeArea: false,
|
||||||
barrierDismissible: true,
|
// barrierDismissible: true,
|
||||||
builder: (context) {
|
// builder: (context) {
|
||||||
return StackDialog(
|
// return StackDialog(
|
||||||
title: "Confirm send all",
|
// title: "Confirm send all",
|
||||||
message:
|
// message:
|
||||||
"You are about to send your entire balance. Would you like to continue?",
|
// "You are about to send your entire balance. Would you like to continue?",
|
||||||
leftButton: TextButton(
|
// leftButton: TextButton(
|
||||||
style: Theme.of(context)
|
// style: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
// .extension<StackColors>()!
|
||||||
.getSecondaryEnabledButtonStyle(context),
|
// .getSecondaryEnabledButtonStyle(context),
|
||||||
child: Text(
|
// child: Text(
|
||||||
"Cancel",
|
// "Cancel",
|
||||||
style: STextStyles.button(context).copyWith(
|
// style: STextStyles.button(context).copyWith(
|
||||||
color: Theme.of(context)
|
// color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
// .extension<StackColors>()!
|
||||||
.accentColorDark),
|
// .accentColorDark),
|
||||||
),
|
// ),
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Navigator.of(context).pop(false);
|
// Navigator.of(context).pop(false);
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
rightButton: TextButton(
|
// rightButton: TextButton(
|
||||||
style: Theme.of(context)
|
// style: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
// .extension<StackColors>()!
|
||||||
.getPrimaryEnabledButtonStyle(context),
|
// .getPrimaryEnabledButtonStyle(context),
|
||||||
child: Text(
|
// child: Text(
|
||||||
"Yes",
|
// "Yes",
|
||||||
style: STextStyles.button(context),
|
// style: STextStyles.button(context),
|
||||||
),
|
// ),
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Navigator.of(context).pop(true);
|
// Navigator.of(context).pop(true);
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (shouldSendAll == null || shouldSendAll == false) {
|
// if (shouldSendAll == null || shouldSendAll == false) {
|
||||||
// cancel preview
|
// // cancel preview
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
bool wasCancelled = false;
|
bool wasCancelled = false;
|
||||||
|
@ -908,18 +908,18 @@ class _TokenSendViewState extends ConsumerState<TokenSendView> {
|
||||||
style: STextStyles.smallMed12(context),
|
style: STextStyles.smallMed12(context),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
CustomTextButton(
|
// CustomTextButton(
|
||||||
text: "Send all ${tokenContract.symbol}",
|
// text: "Send all ${tokenContract.symbol}",
|
||||||
onTap: () async {
|
// onTap: () async {
|
||||||
cryptoAmountController.text = ref
|
// cryptoAmountController.text = ref
|
||||||
.read(tokenServiceProvider)!
|
// .read(tokenServiceProvider)!
|
||||||
.balance
|
// .balance
|
||||||
.getSpendable()
|
// .getSpendable()
|
||||||
.toStringAsFixed(tokenContract.decimals);
|
// .toStringAsFixed(tokenContract.decimals);
|
||||||
|
//
|
||||||
_cryptoAmountChanged();
|
// _cryptoAmountChanged();
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
Loading…
Reference in a new issue