Skip to content

Commit

Permalink
feat(firebase_ui_auth): add autofocus property to PhoneInput widget (#…
Browse files Browse the repository at this point in the history
…334)

Co-authored-by: russellwheatley <russellwheatley85@gmail.com>
  • Loading branch information
orenagiv and russellwheatley authored May 14, 2024
1 parent 2f96686 commit eb9e2bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/firebase_ui_auth/lib/src/widgets/phone_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class PhoneInput extends StatefulWidget {
/// picker.
final String? initialCountryCode;

/// Whether the phone input text field should be focused as soon as it's visible.
final bool autoFocus;

/// Returns a phone number from the [PhoneInput] that was provided a [key].
static String? getPhoneNumber(GlobalKey<PhoneInputState> key) {
final state = key.currentState!;
Expand All @@ -106,6 +109,7 @@ class PhoneInput extends StatefulWidget {
const PhoneInput({
super.key,
this.initialCountryCode,
this.autoFocus = true,
this.onSubmit,
});

Expand Down Expand Up @@ -318,7 +322,7 @@ class PhoneInputState extends State<PhoneInput> {
autofillHints: const [
AutofillHints.telephoneNumberNational
],
autofocus: true,
autofocus: widget.autoFocus,
focusNode: numberFocusNode,
controller: numberController,
placeholder: l.phoneInputLabel,
Expand Down

0 comments on commit eb9e2bd

Please sign in to comment.