fix(auth): per-country phone mask hint and Indonesia digit count
This commit is contained in:
@@ -166,7 +166,7 @@ const String _countriesEnJson = '''[
|
||||
{"id": 348, "alpha2": "hu", "alpha3": "hun", "name": "Hungary", "phoneCode": "+36", "phoneDigits": 9, "phoneMask": "## ### ####", "phoneGroupSizes": [2, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 352, "alpha2": "is", "alpha3": "isl", "name": "Iceland", "phoneCode": "+354", "phoneDigits": 7, "phoneMask": "### ####", "phoneGroupSizes": [3, 4], "phoneGroupSeparators": ["", " ", ""]},
|
||||
{"id": 356, "alpha2": "in", "alpha3": "ind", "name": "India", "phoneCode": "+91", "phoneDigits": 10, "phoneMask": "##### #####", "phoneGroupSizes": [5, 5], "phoneGroupSeparators": ["", " ", ""]},
|
||||
{"id": 360, "alpha2": "id", "alpha3": "idn", "name": "Indonesia", "phoneCode": "+62", "phoneDigits": 10, "phoneMask": "### #### ####", "phoneGroupSizes": [3, 4, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 360, "alpha2": "id", "alpha3": "idn", "name": "Indonesia", "phoneCode": "+62", "phoneDigits": 11, "phoneMask": "### #### ####", "phoneGroupSizes": [3, 4, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 364, "alpha2": "ir", "alpha3": "irn", "name": "Iran, Islamic Republic of", "phoneCode": "+98", "phoneDigits": 10, "phoneMask": "### ### ####", "phoneGroupSizes": [3, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 368, "alpha2": "iq", "alpha3": "irq", "name": "Iraq", "phoneCode": "+964", "phoneDigits": 10, "phoneMask": "### ### ####", "phoneGroupSizes": [3, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 372, "alpha2": "ie", "alpha3": "irl", "name": "Ireland", "phoneCode": "+353", "phoneDigits": 9, "phoneMask": "## ### ####", "phoneGroupSizes": [2, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
@@ -342,7 +342,7 @@ const String _countriesRuJson = '''[
|
||||
{"id": 716, "alpha2": "zw", "alpha3": "zwe", "name": "Зимбабве", "phoneCode": "+263", "phoneDigits": 9, "phoneMask": "## ### ####", "phoneGroupSizes": [2, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 376, "alpha2": "il", "alpha3": "isr", "name": "Израиль", "phoneCode": "+972", "phoneDigits": 9, "phoneMask": "##-###-####", "phoneGroupSizes": [2, 3, 4], "phoneGroupSeparators": ["", "-", "-", ""]},
|
||||
{"id": 356, "alpha2": "in", "alpha3": "ind", "name": "Индия", "phoneCode": "+91", "phoneDigits": 10, "phoneMask": "##### #####", "phoneGroupSizes": [5, 5], "phoneGroupSeparators": ["", " ", ""]},
|
||||
{"id": 360, "alpha2": "id", "alpha3": "idn", "name": "Индонезия", "phoneCode": "+62", "phoneDigits": 10, "phoneMask": "### #### ####", "phoneGroupSizes": [3, 4, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 360, "alpha2": "id", "alpha3": "idn", "name": "Индонезия", "phoneCode": "+62", "phoneDigits": 11, "phoneMask": "### #### ####", "phoneGroupSizes": [3, 4, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 400, "alpha2": "jo", "alpha3": "jor", "name": "Иордания", "phoneCode": "+962", "phoneDigits": 9, "phoneMask": "# #### ####", "phoneGroupSizes": [1, 4, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 368, "alpha2": "iq", "alpha3": "irq", "name": "Ирак", "phoneCode": "+964", "phoneDigits": 10, "phoneMask": "### ### ####", "phoneGroupSizes": [3, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
{"id": 364, "alpha2": "ir", "alpha3": "irn", "name": "Иран", "phoneCode": "+98", "phoneDigits": 10, "phoneMask": "### ### ####", "phoneGroupSizes": [3, 3, 4], "phoneGroupSeparators": ["", " ", " ", ""]},
|
||||
|
||||
@@ -97,6 +97,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
return lang == 'ru' ? country.ru : country.en;
|
||||
}
|
||||
|
||||
String _phoneMaskHint(CountryName country) {
|
||||
return country.phoneMask.replaceAll('#', '0');
|
||||
}
|
||||
|
||||
void _showLanguagePicker() {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
@@ -740,6 +744,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
key: ValueKey(_selectedCountry.code),
|
||||
controller: _phoneController,
|
||||
keyboardType: TextInputType.phone,
|
||||
inputFormatters: [
|
||||
@@ -752,7 +757,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: l10n.loginPhoneHint,
|
||||
hintText: _phoneMaskHint(_selectedCountry),
|
||||
hintStyle: TextStyle(
|
||||
color: cs.outline,
|
||||
fontSize: 15,
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"loginSubtitle": "Check your country code and enter your\nphone number.",
|
||||
"loginCountry": "Country",
|
||||
"loginPhoneNumber": "Phone number",
|
||||
"loginPhoneHint": "(000) 000-00-00",
|
||||
"loginOtherSignInMethods": "Other sign-in methods",
|
||||
"loginTermsIntro": "By continuing, you agree to \n",
|
||||
"loginTermsLink": "the terms of use",
|
||||
|
||||
@@ -122,12 +122,6 @@ abstract class AppLocalizations {
|
||||
/// **'Phone number'**
|
||||
String get loginPhoneNumber;
|
||||
|
||||
/// No description provided for @loginPhoneHint.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'(000) 000-00-00'**
|
||||
String get loginPhoneHint;
|
||||
|
||||
/// No description provided for @loginOtherSignInMethods.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -21,9 +21,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get loginPhoneNumber => 'Phone number';
|
||||
|
||||
@override
|
||||
String get loginPhoneHint => '(000) 000-00-00';
|
||||
|
||||
@override
|
||||
String get loginOtherSignInMethods => 'Other sign-in methods';
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get loginPhoneNumber => 'Номер телефона';
|
||||
|
||||
@override
|
||||
String get loginPhoneHint => '(000) 000-00-00';
|
||||
|
||||
@override
|
||||
String get loginOtherSignInMethods => 'Другие способы входа';
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"loginSubtitle": "Проверьте код страны и введите свой\nномер телефона.",
|
||||
"loginCountry": "Страна",
|
||||
"loginPhoneNumber": "Номер телефона",
|
||||
"loginPhoneHint": "(000) 000-00-00",
|
||||
"loginOtherSignInMethods": "Другие способы входа",
|
||||
"loginTermsIntro": "Продолжая, вы соглашаетесь с \n",
|
||||
"loginTermsLink": "пользовательскими соглашениями",
|
||||
|
||||
Reference in New Issue
Block a user