@@ -9,7 +9,7 @@ class CountryDropdown extends StatefulWidget {
99 final CountryItemBuilder ? selectedItemBuilder;
1010 final CountryItemBuilder ? listItemBuilder;
1111 final bool printCountryName;
12- final String ? initialCountryCode ;
12+ final String ? initialPhoneCode ;
1313 final ValueChanged <PhoneCountryData > onCountrySelected;
1414
1515 final int elevation;
@@ -30,6 +30,7 @@ class CountryDropdown extends StatefulWidget {
3030 final bool ? enableFeedback;
3131 final AlignmentGeometry alignment;
3232
33+ /// [initialPhoneCode] a phone code of the country without leading +
3334 /// [selectedItemBuilder] use this if you want to make
3435 /// the selected item look the way you want
3536 /// [listItemBuilder] the same as [selectedItemBuilder] but
@@ -42,7 +43,7 @@ class CountryDropdown extends StatefulWidget {
4243 this .selectedItemBuilder,
4344 this .listItemBuilder,
4445 this .printCountryName = false ,
45- this .initialCountryCode ,
46+ this .initialPhoneCode ,
4647 required this .onCountrySelected,
4748 this .elevation = 8 ,
4849 this .style,
@@ -81,9 +82,9 @@ class _CountryDropdownState extends State<CountryDropdown> {
8182 }
8283
8384 PhoneCountryData get _initialValue {
84- if (widget.initialCountryCode != null ) {
85+ if (widget.initialPhoneCode != null ) {
8586 return PhoneCodes .getAllCountryDatas ().firstWhereOrNull ((c) =>
86- c.countryCode == widget.initialCountryCode ! . toUpperCase () ) ??
87+ c.phoneCode == widget.initialPhoneCode ) ??
8788 PhoneCodes .getAllCountryDatas ().first;
8889 }
8990 return PhoneCodes .getAllCountryDatas ().first;
0 commit comments