fix: Node Issues (#2498)

- Allow adding new nodes without port
- Replace default port number for empty string when there's no port added
This commit is contained in:
David Adegoke
2025-09-05 16:41:11 +03:00
committed by GitHub
parent 067313e077
commit f0ca065a48
3 changed files with 12 additions and 8 deletions
+6 -4
View File
@@ -4,8 +4,10 @@ import 'package:cake_wallet/core/validator.dart';
class NodePortValidator extends TextValidator {
NodePortValidator()
: super(
errorMessage: S.current.error_text_node_port,
minLength: 0,
maxLength: 5,
pattern: '^[0-9]');
errorMessage: S.current.error_text_node_port,
minLength: 0,
maxLength: 5,
pattern: '^[0-9]',
isAutovalidate: true,
);
}
+5 -2
View File
@@ -19,7 +19,10 @@ class NodeForm extends StatelessWidget {
this.type,
}) : _addressController = TextEditingController(text: editingNode?.uri.host.toString()),
_pathController = TextEditingController(text: editingNode?.path.toString()),
_portController = TextEditingController(text: editingNode?.uri.port.toString()),
_portController = TextEditingController(
text: (editingNode != null && editingNode.uri.hasPort)
? editingNode.uri.port.toString()
: ''),
_loginController = TextEditingController(text: editingNode?.login),
_passwordController = TextEditingController(text: editingNode?.password),
_socksAddressController = TextEditingController(text: editingNode?.socksProxyAddress) {
@@ -27,7 +30,7 @@ class NodeForm extends StatelessWidget {
nodeViewModel
..setAddress((editingNode!.uri.host.toString()))
..setPath((editingNode!.path.toString()))
..setPort((editingNode!.uri.port.toString()))
..setPort((editingNode!.uri.hasPort ? editingNode!.uri.port.toString() : ''))
..setPassword((editingNode!.password ?? ''))
..setLogin((editingNode!.login ?? ''))
..setSSL((editingNode!.isSSL))
@@ -71,8 +71,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@computed
bool get isReady =>
(address.isNotEmpty && port.isNotEmpty) ||
_walletType == WalletType.decred; // Allow an empty address.
(address.isNotEmpty) || _walletType == WalletType.decred; // Allow an empty address.
bool get hasAuthCredentials =>
_walletType == WalletType.monero || _walletType == WalletType.wownero || _walletType == WalletType.haven;