Skip to content

Commit eb9e2bd

Browse files
feat(firebase_ui_auth): add autofocus property to PhoneInput widget (#334)
Co-authored-by: russellwheatley <[email protected]>
1 parent 2f96686 commit eb9e2bd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/firebase_ui_auth/lib/src/widgets/phone_input.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ class PhoneInput extends StatefulWidget {
9191
/// picker.
9292
final String? initialCountryCode;
9393

94+
/// Whether the phone input text field should be focused as soon as it's visible.
95+
final bool autoFocus;
96+
9497
/// Returns a phone number from the [PhoneInput] that was provided a [key].
9598
static String? getPhoneNumber(GlobalKey<PhoneInputState> key) {
9699
final state = key.currentState!;
@@ -106,6 +109,7 @@ class PhoneInput extends StatefulWidget {
106109
const PhoneInput({
107110
super.key,
108111
this.initialCountryCode,
112+
this.autoFocus = true,
109113
this.onSubmit,
110114
});
111115

@@ -318,7 +322,7 @@ class PhoneInputState extends State<PhoneInput> {
318322
autofillHints: const [
319323
AutofillHints.telephoneNumberNational
320324
],
321-
autofocus: true,
325+
autofocus: widget.autoFocus,
322326
focusNode: numberFocusNode,
323327
controller: numberController,
324328
placeholder: l.phoneInputLabel,

0 commit comments

Comments
 (0)