select_country_code_phone
for locale language change
dependencies :
flutter :
sdk : flutter
flutter_localizations : # Add this line
sdk : flutter # Add this line
import 'package:flutter_localizations/flutter_localizations.dart' ;
return const MaterialApp (
title: 'Flutter Country Phone Code Input' ,
supportedLocales: [
const Locale ('en' ),
const Locale ('el' ),
const Locale .fromSubtags (languageCode: 'zh' , scriptCode: 'Hans' ), // Generic Simplified Chinese 'zh_Hans'
const Locale .fromSubtags (languageCode: 'zh' , scriptCode: 'Hant' ), // Generic traditional Chinese 'zh_Hant'
],
localizationsDelegates: [
CountryLocalizations .delegate,
Locale ('es' , '' ), // Spanish, no country code
],
home: HomeScreen (),
);
CountryPhoneTextField (
fillColor: Colors .white,
initialCountryCode: 'TR' ,
exclude: ['EN' , 'FR' ],
onCountry: (country) {
log (country! .countryCode);
},
)
TextEditingController textController
input validator for error
Function(String?)? validator;
Function(String? country)? phoneCode;
Country is like ['TR'] for TURKEY.
Exclude: Can be used to exclude(remove) one or more country
from the countries list (optional).
Style of country phone code
countryListTheme: Can be used to customize the country
list's bottom sheet and widgets that lie within it. (optional).
final CountryListThemeData? countryListTheme;
Selected and inital Country flag size