mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-15 16:12:16 +00:00
allow "," decimal separator in qr code generator
This commit is contained in:
parent
b84c3ab2d3
commit
5496d2de96
1 changed files with 12 additions and 1 deletions
|
@ -144,7 +144,18 @@ class _GenerateUriQrCodeViewState extends State<GenerateUriQrCodeView> {
|
|||
final amountString = amountController.text;
|
||||
final noteString = noteController.text;
|
||||
|
||||
if (amountString.isNotEmpty && Decimal.tryParse(amountString) == null) {
|
||||
// try "."
|
||||
Decimal? amount = Decimal.tryParse(amountString);
|
||||
if (amount == null) {
|
||||
// try single instance of ","
|
||||
final first = amountString.indexOf(",");
|
||||
final last = amountString.lastIndexOf(",");
|
||||
if (first == last) {
|
||||
amount = Decimal.tryParse(amountString.replaceFirst(",", "."));
|
||||
}
|
||||
}
|
||||
|
||||
if (amountString.isNotEmpty && amount == null) {
|
||||
showFloatingFlushBar(
|
||||
type: FlushBarType.warning,
|
||||
message: "Invalid amount",
|
||||
|
|
Loading…
Reference in a new issue