mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
CAKE-20 | updated send and send template pages; added send_template_store and exchange_template_store; created base_send_widget; applied send_template_store to send_view_model; applied base_send_widget to send and send template pages; added properties to address_text_field, base_text_field and template_tile
This commit is contained in:
@@ -13,10 +13,10 @@ class AmountValidator extends TextValidator {
|
||||
static String _pattern(WalletType type) {
|
||||
switch (type) {
|
||||
case WalletType.monero:
|
||||
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12})\$';
|
||||
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12}|ALL)\$';
|
||||
case WalletType.bitcoin:
|
||||
// FIXME: Incorrect pattern for bitcoin
|
||||
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12})\$';
|
||||
return '^([0-9]+([.][0-9]{0,12})?|[.][0-9]{1,12}|ALL)\$';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:cake_wallet/core/validator.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class TemplateValidator extends TextValidator {
|
||||
TemplateValidator()
|
||||
: super(
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
pattern: '''^[^`,'"]{1,20}\$''',
|
||||
errorMessage: S.current.error_text_template
|
||||
);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class TextValidator extends Validator<String> {
|
||||
@override
|
||||
bool isValid(String value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return value.length > (minLength ?? 0) &&
|
||||
@@ -42,4 +42,4 @@ class TextValidator extends Validator<String> {
|
||||
class WalletNameValidator extends TextValidator {
|
||||
WalletNameValidator()
|
||||
: super(minLength: 1, maxLength: 15, pattern: '^[a-zA-Z0-9_]\$');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user