phonefield 1.0.2 copy "phonefield: ^1.0.2" to clipboard
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
5
likes
150
points
71
downloads
screenshot

Publisher

verified publisherneupanenitesh.com.np

Weekly Downloads

2024.08.30 - 2025.03.14

The PhoneField package offers easy phone number input with validation, formatting, and internationalization support, ensuring accurate phone number handling.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

dio, dropdown_search, flutter

More

Packages that depend on phonefield