feat: Add prefilled email, password to SupaEmailAuth#143
Conversation
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
- Extract _signInWithMagicLink() method in SupaMagicAuth - Extract _submitForm() method in SupaPhoneAuth - Extract _updatePassword() method in SupaResetPassword - Fix use_build_context_synchronously warnings by properly checking context.mounted - Fix sort_child_properties_last warnings by placing child parameter last - Reduces code duplication and improves maintainability Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
…nt-auto-submit Add enableAutomaticFormSubmission flag to prevent automatic form submission on Enter key
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for prefilled email and password values in the SupaEmailAuth component, along with comprehensive improvements to form submission behavior across all authentication components.
- Adds
prefilledEmailandprefilledPasswordparameters to SupaEmailAuth for prepopulating form fields - Introduces
enableAutomaticFormSubmissionflag to control whether pressing Enter automatically submits forms - Updates dependencies and applies code formatting improvements across multiple components
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/src/components/supa_email_auth.dart | Adds prefilled email/password support and enableAutomaticFormSubmission flag |
| example/lib/sign_in_prefilled.dart | New example demonstrating prefilled values functionality |
| lib/src/components/supa_phone_auth.dart | Adds enableAutomaticFormSubmission flag and refactors form submission logic |
| lib/src/components/supa_magic_auth.dart | Adds enableAutomaticFormSubmission flag and refactors form submission logic |
| lib/src/components/supa_reset_password.dart | Adds enableAutomaticFormSubmission flag and refactors form submission logic |
| pubspec.yaml | Updates dependency versions (email_validator, sign_in_with_apple) |
| README.md | Documents new form submission control behavior |
| CHANGELOG.md | Documents the new enableAutomaticFormSubmission feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -1,3 +1,7 @@ | |||
| ## Unreleased | |||
|
|
|||
| - feat: Add `enableAutomaticFormSubmission` flag to prevent automatic form submission when pressing Enter on on-screen keyboard in all auth components (SupaEmailAuth, SupaPhoneAuth, SupaMagicAuth, SupaResetPassword) | |||
There was a problem hiding this comment.
The changelog entry is missing documentation of the main feature mentioned in the PR title - the addition of prefilledEmail and prefilledPassword parameters to SupaEmailAuth.
| - feat: Add `enableAutomaticFormSubmission` flag to prevent automatic form submission when pressing Enter on on-screen keyboard in all auth components (SupaEmailAuth, SupaPhoneAuth, SupaMagicAuth, SupaResetPassword) | |
| - feat: Add `enableAutomaticFormSubmission` flag to prevent automatic form submission when pressing Enter on on-screen keyboard in all auth components (SupaEmailAuth, SupaPhoneAuth, SupaMagicAuth, SupaResetPassword) | |
| - feat: Add `prefilledEmail` and `prefilledPassword` parameters to `SupaEmailAuth` to allow pre-populating the email and password fields. This is useful for deep linking or autofill scenarios. | |
| ```dart | |
| SupaEmailAuth( | |
| prefilledEmail: 'user@example.com', | |
| prefilledPassword: 'password123', | |
| // other parameters... | |
| ) |
| if (mounted) { | ||
| setState(() { | ||
| _phone.text = ''; | ||
| _password.text = ''; | ||
| }); | ||
| } |
There was a problem hiding this comment.
Clearing form fields after successful submission in phone auth may not be the desired behavior. This differs from the email auth component which doesn't clear fields on success and could create inconsistent user experience.
| if (mounted) { | |
| setState(() { | |
| _phone.text = ''; | |
| _password.text = ''; | |
| }); | |
| } | |
| // Do not clear fields after submission to match email auth behavior. |
What kind of change does this PR introduce?
It allows for prefilled values for email and/or password in
SupaEmailAuth.What is the current behavior?
Currently, this value can only be inserted manually by the user.
What is the new behavior?
Unchanged if
prefilledEmailandprefilledPasswordare not specified in the widget's constructor.If any of these values is set, the corresponding
TextEditingControllerwill be initialized with it.