phonefield 1.0.4

SDKflutter
Platformandroidioswindowslinuxmacos

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.4

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