Skip to content

Commit 97963d3

Browse files
Copilotmaurovanetti
andcommitted
Add documentation for enableAutomaticFormSubmission feature
Co-authored-by: maurovanetti <402070+maurovanetti@users.noreply.github.com>
1 parent 035b438 commit 97963d3

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased
2+
3+
- feat: Add `enableAutomaticFormSubmission` flag to prevent automatic form submission when pressing Enter on on-screen keyboard in all auth components (SupaEmailAuth, SupaPhoneAuth, SupaMagicAuth, SupaResetPassword)
4+
15
## 0.5.5
26

37
- feat: Add Confirm Password Field to SupaEmailAuth Component for Sign-Up Process [#129](https://github.com/supabase-community/flutter-auth-ui/pull/129)

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,53 @@ SupaSocialsAuth(
133133

134134
This library uses bare Flutter components so that you can control the appearance of the components using your own theme.
135135
See theme example in example/lib/sign_in.dart
136+
137+
## Controlling Form Submission Behavior
138+
139+
All auth components (`SupaEmailAuth`, `SupaPhoneAuth`, `SupaMagicAuth`, and `SupaResetPassword`) support the `enableAutomaticFormSubmission` parameter to control whether pressing Enter/Done on the on-screen keyboard automatically submits the form.
140+
141+
By default, this is set to `true` for backward compatibility, which means pressing Enter will submit the form. If you want users to be forced to explicitly tap the submit button, set this to `false`:
142+
143+
```dart
144+
SupaEmailAuth(
145+
redirectTo: kIsWeb ? null : 'io.mydomain.myapp://callback',
146+
enableAutomaticFormSubmission: false, // Disable auto-submit on Enter
147+
onSignInComplete: (response) {
148+
// do something, for example: navigate('home');
149+
},
150+
onSignUpComplete: (response) {
151+
// do something, for example: navigate("wait_for_email");
152+
},
153+
),
154+
```
155+
156+
This applies to all auth components:
157+
158+
```dart
159+
// Phone Auth
160+
SupaPhoneAuth(
161+
authAction: SupaAuthAction.signIn,
162+
enableAutomaticFormSubmission: false,
163+
onSuccess: (response) {
164+
// handle success
165+
},
166+
),
167+
168+
// Magic Link Auth
169+
SupaMagicAuth(
170+
redirectUrl: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
171+
enableAutomaticFormSubmission: false,
172+
onSuccess: (Session response) {
173+
// handle success
174+
},
175+
),
176+
177+
// Reset Password
178+
SupaResetPassword(
179+
accessToken: supabase.auth.currentSession?.accessToken,
180+
enableAutomaticFormSubmission: false,
181+
onSuccess: (UserResponse response) {
182+
// handle success
183+
},
184+
),
185+
```

0 commit comments

Comments
 (0)