mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
fix: amount getting wiped when pasting address
This commit is contained in:
parent
a3c2102379
commit
0aace0cf7d
2 changed files with 13 additions and 6 deletions
|
@ -302,7 +302,8 @@ class ExchangeCardState<T extends Currency> extends State<ExchangeCard<T>> {
|
|||
final paymentRequest = PaymentRequest.fromUri(uri);
|
||||
addressController.text = paymentRequest.address;
|
||||
|
||||
if (amountController.text.isNotEmpty) {
|
||||
if (amountController.text.isNotEmpty &&
|
||||
paymentRequest.amount.isNotEmpty) {
|
||||
_showAmountPopup(context, paymentRequest);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -263,6 +263,9 @@ class AddressTextField<T extends Currency> extends StatelessWidget {
|
|||
final address = clipboard?.text ?? '';
|
||||
|
||||
if (address.isNotEmpty) {
|
||||
// if it has query parameters then it's a valid uri
|
||||
// added because Uri.parse(address) can parse a normal address string and would still be valid
|
||||
if (address.contains("=")) {
|
||||
try {
|
||||
final uri = Uri.parse(address);
|
||||
controller?.text = uri.path;
|
||||
|
@ -270,6 +273,9 @@ class AddressTextField<T extends Currency> extends StatelessWidget {
|
|||
} catch (_) {
|
||||
controller?.text = address;
|
||||
}
|
||||
} else {
|
||||
controller?.text = address;
|
||||
}
|
||||
}
|
||||
|
||||
onPushPasteButton?.call(context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue