phonefield 1.0.2
phonefield: ^1.0.2 copied to clipboard
The PhoneField package offers easy phone number input with validation, formatting, and internationalization support, ensuring accurate phone number handling.
Phonefield
Features #
Custom phone field with picker
Getting started #
To use this package, add phonefield
to your pubspec.yaml
file:
dependencies:
phonefield: ^1.0.0
copied to clipboard
Usage #
Check out the example directory for detailed examples:
PhoneField(
initialPhoneNumber: "+977",
onChanged: (p0) {
phoneNumber = p0;
setState(() {});
},
)
copied to clipboard
Country Picker
CountryPicker(
labelText: "Country",
hintText: "Select a country",
selectedCountry: selectedCountry,
onChanged: (p0) {
selectedState.value = null;
},
validator: (p0) {
if (p0 == null) {
return "Please select country ";
}
return null;
},
),
copied to clipboard
State Picker
StatePicker(
enabled: selectedCountry.value != null,
hintText: "Select a state",
countryCode: selectedCountry.value?.code,
selectedState: selectedState,
validator: (p0) {
if (p0 == null || p0.isEmpty) {
return selectedCountry.value != null
? "Please select state"
: "Please select country first and select state";
}
return null;
},
),
copied to clipboard