From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id F2EF11FF191 for ; Tue, 4 Nov 2025 18:37:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2BBA312EE8; Tue, 4 Nov 2025 18:38:29 +0100 (CET) From: Shan Shaji To: pve-devel@lists.proxmox.com Date: Tue, 4 Nov 2025 18:38:06 +0100 Message-ID: <20251104173809.90052-2-s.shaji@proxmox.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251104173809.90052-1-s.shaji@proxmox.com> References: <20251104173809.90052-1-s.shaji@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762277888029 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.123 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH proxmox_login_manager 1/4] fix: ui: disable continue button by default in login form X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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 { PveAccessDomainModel? _selectedDomain; final _formKey = GlobalKey(); ProxmoxProgressModel _progressModel = ProxmoxProgressModel(); - bool _submittButtonEnabled = true; + bool _submitButtonEnabled = false; bool _canSavePassword = false; bool _savePasswordCB = false; @@ -330,7 +330,7 @@ class _ProxmoxLoginPageState extends State { key: _formKey, onChanged: () { setState(() { - _submittButtonEnabled = + _submitButtonEnabled = _formKey.currentState!.validate(); }); }, @@ -381,7 +381,7 @@ class _ProxmoxLoginPageState extends State { final isValid = _formKey.currentState!.validate(); setState(() { - _submittButtonEnabled = isValid; + _submitButtonEnabled = isValid; }); if (isValid) { setState(() { @@ -389,12 +389,12 @@ class _ProxmoxLoginPageState extends State { }); } }, - 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 { 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 pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel