Skip to content

Commit 36eef70

Browse files
authored
feat: add autofocus option to SupaEmailAuth (#139)
1 parent 99513e9 commit 36eef70

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/src/components/supa_email_auth.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ typedef MetadataController = Object;
159159
/// ```
160160
/// {@endtemplate}
161161
class SupaEmailAuth extends StatefulWidget {
162+
/// Whether the email field should automatically focus when the form is shown
163+
final bool autofocus;
164+
162165
/// The URL to redirect the user to when clicking on the link on the
163166
/// confirmation link after signing up.
164167
final String? redirectTo;
@@ -220,6 +223,7 @@ class SupaEmailAuth extends StatefulWidget {
220223
/// {@macro supa_email_auth}
221224
const SupaEmailAuth({
222225
super.key,
226+
this.autofocus = true,
223227
this.redirectTo,
224228
this.resetPasswordRedirectTo,
225229
this.passwordValidator,
@@ -298,7 +302,7 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
298302
keyboardType: TextInputType.emailAddress,
299303
autofillHints: const [AutofillHints.email],
300304
autovalidateMode: AutovalidateMode.onUserInteraction,
301-
autofocus: true,
305+
autofocus: widget.autofocus,
302306
focusNode: _emailFocusNode,
303307
textInputAction: _isRecoveringPassword
304308
? TextInputAction.done

0 commit comments

Comments
 (0)