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

Usage

Check out the example directory for detailed examples:

PhoneField(
    initialPhoneNumber: "+977",
    onChanged: (p0) {
        phoneNumber = p0;
        setState(() {});
        },
    )

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;
  },
),

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;
    },
  ),