From 7d81786322013df7f0a087e79f3abebbb4ece6cc Mon Sep 17 00:00:00 2001 From: Andrei Lesnitsky Date: Mon, 9 Jan 2023 17:23:51 +0100 Subject: [PATCH] fix(ui_auth): fix PhoneInputScreen layout (#10227) --- .../lib/src/screens/phone_input_screen.dart | 2 + .../lib/src/widgets/phone_input.dart | 85 ++++++++++--------- 2 files changed, 46 insertions(+), 41 deletions(-) diff --git a/packages/firebase_ui_auth/lib/src/screens/phone_input_screen.dart b/packages/firebase_ui_auth/lib/src/screens/phone_input_screen.dart index dd4f05826610..251dee0ee0ed 100644 --- a/packages/firebase_ui_auth/lib/src/screens/phone_input_screen.dart +++ b/packages/firebase_ui_auth/lib/src/screens/phone_input_screen.dart @@ -119,6 +119,7 @@ class PhoneInputScreen extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(20), child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ PhoneInputView( auth: auth, @@ -129,6 +130,7 @@ class PhoneInputScreen extends StatelessWidget { multiFactorSession: multiFactorSession, mfaHint: mfaHint, ), + const SizedBox(height: 8), UniversalButton( text: l.goBackButtonLabel, variant: ButtonVariant.text, diff --git a/packages/firebase_ui_auth/lib/src/widgets/phone_input.dart b/packages/firebase_ui_auth/lib/src/widgets/phone_input.dart index 0010acb548c2..2be80199eddb 100644 --- a/packages/firebase_ui_auth/lib/src/widgets/phone_input.dart +++ b/packages/firebase_ui_auth/lib/src/widgets/phone_input.dart @@ -287,49 +287,52 @@ class PhoneInputState extends State { const SizedBox(height: 16), Directionality( textDirection: TextDirection.ltr, - child: Row( - children: [ - SizedBox( - width: 90, - child: UniversalTextFormField( - autofillHints: const [ - AutofillHints.telephoneNumberCountryCode - ], - controller: countryController, - prefix: const Text('+'), - placeholder: l.countryCode, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - keyboardType: TextInputType.phone, - validator: NotEmpty('').validate, - onSubmitted: (_) { - numberFocusNode.requestFocus(); - }, + child: IntrinsicHeight( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 90, + child: UniversalTextFormField( + autofillHints: const [ + AutofillHints.telephoneNumberCountryCode + ], + controller: countryController, + prefix: const Text('+'), + placeholder: l.countryCode, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + keyboardType: TextInputType.phone, + validator: NotEmpty('').validate, + onSubmitted: (_) { + numberFocusNode.requestFocus(); + }, + ), ), - ), - const SizedBox(width: 8), - Expanded( - child: UniversalTextFormField( - autofillHints: const [ - AutofillHints.telephoneNumberNational - ], - autofocus: true, - focusNode: numberFocusNode, - controller: numberController, - placeholder: l.phoneInputLabel, - validator: Validator.validateAll([ - NotEmpty(l.phoneNumberIsRequiredErrorText), - PhoneValidator(l.phoneNumberInvalidErrorText), - ]), - onSubmitted: _onSubmitted, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - keyboardType: TextInputType.phone, + const SizedBox(width: 8), + Expanded( + child: UniversalTextFormField( + autofillHints: const [ + AutofillHints.telephoneNumberNational + ], + autofocus: true, + focusNode: numberFocusNode, + controller: numberController, + placeholder: l.phoneInputLabel, + validator: Validator.validateAll([ + NotEmpty(l.phoneNumberIsRequiredErrorText), + PhoneValidator(l.phoneNumberInvalidErrorText), + ]), + onSubmitted: _onSubmitted, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + keyboardType: TextInputType.phone, + ), ), - ), - ], + ], + ), ), ), ],