fix: fiat amount when sending all (#1516)

* fix: fiat amount when sending all

* possible fix for pending txs
workaroudn update

* also for wow
This commit is contained in:
cyan
2024-07-06 16:01:42 +03:00
committed by GitHub
parent c5d3cbf66c
commit 0335702aa9
6 changed files with 39 additions and 14 deletions
+3 -1
View File
@@ -332,7 +332,9 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
width: prefixIconWidth,
height: prefixIconHeight,
child: InkWell(
onTap: () async => output.setSendAll(),
onTap: () async {
output.setSendAll(sendViewModel.balance);
},
child: Container(
decoration: BoxDecoration(
color: Theme.of(context)
+9 -3
View File
@@ -38,6 +38,7 @@ abstract class OutputBase with Store {
key = UniqueKey(),
sendAll = false,
cryptoAmount = '',
cryptoFullBalance = '',
fiatAmount = '',
address = '',
note = '',
@@ -54,6 +55,9 @@ abstract class OutputBase with Store {
@observable
String cryptoAmount;
@observable
String cryptoFullBalance;
@observable
String address;
@@ -202,9 +206,11 @@ abstract class OutputBase with Store {
final SettingsStore _settingsStore;
final FiatConversionStore _fiatConversationStore;
final NumberFormat _cryptoNumberFormat;
@action
void setSendAll() => sendAll = true;
void setSendAll(String fullBalance) {
cryptoFullBalance = fullBalance;
sendAll = true;
}
@action
void reset() {
@@ -243,7 +249,7 @@ abstract class OutputBase with Store {
try {
final fiat = calculateFiatAmount(
price: _fiatConversationStore.prices[cryptoCurrencyHandler()]!,
cryptoAmount: cryptoAmount.replaceAll(',', '.'));
cryptoAmount: sendAll ? cryptoFullBalance.replaceAll(",", ".") : cryptoAmount.replaceAll(',', '.'));
if (fiatAmount != fiat) {
fiatAmount = fiat;
}