dialcodeselector 2.0.1
dialcodeselector: ^2.0.1 copied to clipboard
Flutter package for selecting a country or country dial code.
dialcodeselector Package #
Package designed to select either country or country dial code
Screens #
![](screenshots/Screenshot_1.png)
![](screenshots/Screenshot_3.png)
![](screenshots/Screenshot_3.png)
pubspec.yaml #
dialcodeselector: <last version>
import #
import 'package:dialcodeselector/dialcodeselector.dart';
Simple example #
//Define your default country
Country? defaultCountry = DialCodeSelector.getCountryByDialCode(dialCode: "233");
//implement callback
void onCountrySelected(Country? country) {
defaultCountry = country;
setState(() {});
}
// Define theme for the country code picker
DialCodeSelectorTheme get selectorTheme =>
DialCodeSelectorTheme(titleColor: Colors.blueGrey);
void showCountryPicker()async{
await DialCodeSelector.selectCountry(BuildContext,
selectorTheme: selectorTheme,
initialShortName: defaultCountry?.countryShortName,
onCountrySelected: onCountrySelected);
}
Features #
- Selecting a country dial code
- Selecting a country
- Returns selected Country name, logo, shortname and dial code
- Get country by shortname
- Get country by dialcode