Skip to content

feat(firebase_ui_auth): add autofocus property to PhoneInput widget #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading