When adding a remote the continue button is initially submit-able, even though the "origin" field is empty. Tapping the button will show the error and greys out the button.
To improve UX the button will be disabled by default and gets enabled only if the form validation succeeds. Also fixed a typo in the boolean variable. Signed-off-by: Shan Shaji <[email protected]> --- lib/proxmox_login_form.dart | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart index 030e546..9e95f27 100644 --- a/lib/proxmox_login_form.dart +++ b/lib/proxmox_login_form.dart @@ -211,7 +211,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> { PveAccessDomainModel? _selectedDomain; final _formKey = GlobalKey<FormState>(); ProxmoxProgressModel _progressModel = ProxmoxProgressModel(); - bool _submittButtonEnabled = true; + bool _submitButtonEnabled = false; bool _canSavePassword = false; bool _savePasswordCB = false; @@ -330,7 +330,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> { key: _formKey, onChanged: () { setState(() { - _submittButtonEnabled = + _submitButtonEnabled = _formKey.currentState!.validate(); }); }, @@ -381,7 +381,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> { final isValid = _formKey.currentState!.validate(); setState(() { - _submittButtonEnabled = isValid; + _submitButtonEnabled = isValid; }); if (isValid) { setState(() { @@ -389,12 +389,12 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> { }); } }, - onPasswordSubmitted: _submittButtonEnabled + onPasswordSubmitted: _submitButtonEnabled ? () { final isValid = _formKey.currentState!.validate(); setState(() { - _submittButtonEnabled = isValid; + _submitButtonEnabled = isValid; }); if (isValid) { _onLoginButtonPressed(); @@ -408,13 +408,13 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> { child: SizedBox( width: MediaQuery.of(context).size.width, child: TextButton( - onPressed: _submittButtonEnabled + onPressed: _submitButtonEnabled ? () { final isValid = _formKey .currentState! .validate(); setState(() { - _submittButtonEnabled = + _submitButtonEnabled = isValid; }); if (isValid) { -- 2.50.1 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
