Skip to content

Commit

Permalink
Add TextInputAction to phone and email sign in (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
pohuing authored Apr 13, 2024
1 parent 45c3fbb commit b3454fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/components/supa_email_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
TextFormField(
keyboardType: TextInputType.emailAddress,
autofillHints: const [AutofillHints.email],
textInputAction:
_forgotPassword ? TextInputAction.done : TextInputAction.next,
validator: (value) {
if (value == null ||
value.isEmpty ||
Expand All @@ -162,6 +164,9 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
autofillHints: _isSigningIn
? [AutofillHints.password]
: [AutofillHints.newPassword],
textInputAction: widget.metadataFields != null && !_isSigningIn
? TextInputAction.next
: TextInputAction.done,
validator: (value) {
if (value == null || value.isEmpty || value.length < 6) {
return localization.passwordLengthError;
Expand All @@ -181,6 +186,10 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
.map((metadataField) => [
TextFormField(
controller: _metadataControllers[metadataField],
textInputAction:
widget.metadataFields!.last == metadataField
? TextInputAction.done
: TextInputAction.next,
decoration: InputDecoration(
label: Text(metadataField.label),
prefixIcon: metadataField.prefixIcon,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/components/supa_phone_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class _SupaPhoneAuthState extends State<SupaPhoneAuth> {
children: [
TextFormField(
autofillHints: const [AutofillHints.telephoneNumber],
textInputAction: TextInputAction.next,
validator: (value) {
if (value == null || value.isEmpty) {
return localization.validPhoneNumberError;
Expand All @@ -74,6 +75,7 @@ class _SupaPhoneAuthState extends State<SupaPhoneAuth> {
autofillHints: isSigningIn
? [AutofillHints.password]
: [AutofillHints.newPassword],
textInputAction: TextInputAction.done,
validator: (value) {
if (value == null || value.isEmpty || value.length < 6) {
return localization.passwordLengthError;
Expand Down

0 comments on commit b3454fa

Please sign in to comment.