country-list-pick
country-list-pick copied to clipboard
country cannot be selected when you use the pickerBuilder and countryBuilder paramters together.
When I use the pickerBuilder parameter to build the widget for the picker, before the country list fragment displays for picking the country, I can select a country. But when I use the countryBuilder to customize it. I cant select a country again.
same problem
This might be late as the issue was opened 2 years ago but this is what i did
countryBuilder: (context, countryCode) { return _buildCountryListItem(context, countryCode); }
Widget _buildCountryListItem(BuildContext context, CountryCode countryCode) { return Container( height: 50, color: Colors.white, child: Material( color: Colors.transparent, child: ListTile( leading: Image.asset( countryCode.flagUri!, package: 'country_list_pick', width: 30.0, ), title: Row( mainAxisSize: MainAxisSize.min, children: [ Text(countryCode.name!), const SizedBox(width: 10), Text('(${countryCode.dialCode!})'), ], ), onTap: () => Navigator.pop(context, countryCode), ), ), ); }
By adding Navigator.pop(context, countryCode)