disable email verification button after initial click in UserProfileForm#1151
Open
pankaj-basnet wants to merge 6 commits intowger-project:masterfrom
Open
Conversation
- Added `_isVerifying` state to track asynchronous verification process - Disabled OutlinedButton during active requests to prevent duplicate API calls - Added CircularProgressIndicator for visual feedback during loading - Included `mounted` checks to prevent memory leaks/crashes on post-await setState - Removed redundant verification check inside the onPressed callback
Author
|
after disabling email verification button when clicked in UserProfileForm like above , i found we still need to either go back to previous screen or click 'save' button to go back. and, we could change the email address while at it. |
- Button becomes disabled immediately after click - Stays disabled after request succeeds - Re-enables only if request fails
- Improve Verify button state handling in UserProfileScreen - Disable "Verify" button after user clicks it - Keep it disabled for the lifetime of the screen - Re-enable on request failure - Reset state when navigating away and back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the "Verify Email" button remains active after the user clicks it. This allows for multiple simultaneous API calls if a user double-taps or clicks rapidly , leading to redundant server-side processing and multiple verification emails.
Proposed Changes
Introduced a boolean state _isVerifying to the UserProfileForm.
The OutlinedButton is now disabled (set to null) while a request is in flight.
Replaced the button text with a CircularProgressIndicator during the loading state to improve UX.
Refactored the onPressed logic to remove a redundant check for widget._profile.emailVerified, as the widget's visibility is already guarded by that condition.
Added if (mounted) guards to ensure setState and ScaffoldMessenger calls are only executed if the user is still on the screen.
Related Issue(s)