- Fix not filling fiat amount

- Fix conflicts with master
This commit is contained in:
OmarHatem 2022-12-12 18:01:42 +02:00
parent 01024b6694
commit 826ae46b07
2 changed files with 11 additions and 6 deletions

View file

@ -29,12 +29,11 @@ class SendPage extends BasePage {
SendPage({ SendPage({
required this.sendViewModel, required this.sendViewModel,
this.initialPaymentRequest, this.initialPaymentRequest,
}) : _formKey = GlobalKey<FormState>(),fiatFromSettings = settingsViewModel.fiatCurrency; }) : _formKey = GlobalKey<FormState>();
final SendViewModel sendViewModel; final SendViewModel sendViewModel;
final GlobalKey<FormState> _formKey; final GlobalKey<FormState> _formKey;
final controller = PageController(initialPage: 0); final controller = PageController(initialPage: 0);
final FiatCurrency fiatFromSettings;
final PaymentRequest? initialPaymentRequest; final PaymentRequest? initialPaymentRequest;
bool _effectsInstalled = false; bool _effectsInstalled = false;

View file

@ -43,8 +43,8 @@ class SendCardState extends State<SendCard>
required this.output, required this.output,
required this.sendViewModel, required this.sendViewModel,
this.initialPaymentRequest}) this.initialPaymentRequest})
: addressController = TextEditingController(text: initialPaymentRequest?.address.toLowerCase()), : addressController = TextEditingController(),
cryptoAmountController = TextEditingController(text: initialPaymentRequest?.amount), cryptoAmountController = TextEditingController(),
fiatAmountController = TextEditingController(), fiatAmountController = TextEditingController(),
noteController = TextEditingController(), noteController = TextEditingController(),
extractedAddressController = TextEditingController(), extractedAddressController = TextEditingController(),
@ -545,8 +545,7 @@ class SendCardState extends State<SendCard>
if (output.address.isNotEmpty) { if (output.address.isNotEmpty) {
addressController.text = output.address; addressController.text = output.address;
} }
if (output.cryptoAmount.isNotEmpty || if (output.cryptoAmount.isNotEmpty) {
sendViewModel.walletCurrencyName != initialPaymentRequest?.scheme.toLowerCase()) {
cryptoAmountController.text = output.cryptoAmount; cryptoAmountController.text = output.cryptoAmount;
} }
fiatAmountController.text = output.fiatAmount; fiatAmountController.text = output.fiatAmount;
@ -640,6 +639,13 @@ class SendCardState extends State<SendCard>
extractedAddressController.text = extractedAddress; extractedAddressController.text = extractedAddress;
}); });
if (initialPaymentRequest != null &&
sendViewModel.walletCurrencyName != initialPaymentRequest!.scheme.toLowerCase()) {
addressController.text = initialPaymentRequest!.address;
cryptoAmountController.text = initialPaymentRequest!.amount;
noteController.text = initialPaymentRequest!.note;
}
_effectsInstalled = true; _effectsInstalled = true;
} }