Skip to content

Commit b3454fa

Browse files
authored
Add TextInputAction to phone and email sign in (#82)
1 parent 45c3fbb commit b3454fa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/src/components/supa_email_auth.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
142142
TextFormField(
143143
keyboardType: TextInputType.emailAddress,
144144
autofillHints: const [AutofillHints.email],
145+
textInputAction:
146+
_forgotPassword ? TextInputAction.done : TextInputAction.next,
145147
validator: (value) {
146148
if (value == null ||
147149
value.isEmpty ||
@@ -162,6 +164,9 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
162164
autofillHints: _isSigningIn
163165
? [AutofillHints.password]
164166
: [AutofillHints.newPassword],
167+
textInputAction: widget.metadataFields != null && !_isSigningIn
168+
? TextInputAction.next
169+
: TextInputAction.done,
165170
validator: (value) {
166171
if (value == null || value.isEmpty || value.length < 6) {
167172
return localization.passwordLengthError;
@@ -181,6 +186,10 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
181186
.map((metadataField) => [
182187
TextFormField(
183188
controller: _metadataControllers[metadataField],
189+
textInputAction:
190+
widget.metadataFields!.last == metadataField
191+
? TextInputAction.done
192+
: TextInputAction.next,
184193
decoration: InputDecoration(
185194
label: Text(metadataField.label),
186195
prefixIcon: metadataField.prefixIcon,

lib/src/components/supa_phone_auth.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class _SupaPhoneAuthState extends State<SupaPhoneAuth> {
5757
children: [
5858
TextFormField(
5959
autofillHints: const [AutofillHints.telephoneNumber],
60+
textInputAction: TextInputAction.next,
6061
validator: (value) {
6162
if (value == null || value.isEmpty) {
6263
return localization.validPhoneNumberError;
@@ -74,6 +75,7 @@ class _SupaPhoneAuthState extends State<SupaPhoneAuth> {
7475
autofillHints: isSigningIn
7576
? [AutofillHints.password]
7677
: [AutofillHints.newPassword],
78+
textInputAction: TextInputAction.done,
7779
validator: (value) {
7880
if (value == null || value.isEmpty || value.length < 6) {
7981
return localization.passwordLengthError;

0 commit comments

Comments
 (0)