Coder Social home page Coder Social logo

Comments (10)

girish54321 avatar girish54321 commented on June 21, 2024 1

Thanks, @inkersgithub worked for me 🎉

from intl_phone_number_input.

natintosh avatar natintosh commented on June 21, 2024

Hi @miller619, this is expected behavior. This is so because the TextEditingController() is working with the TextField, therefore any input the TextField has it what the TextEditingController() would return. I hope this helps

from intl_phone_number_input.

miller619 avatar miller619 commented on June 21, 2024

In that case how do I return the phone number along with the country code?

from intl_phone_number_input.

natintosh avatar natintosh commented on June 21, 2024

Oh by returning do you mean updating ??

from intl_phone_number_input.

miller619 avatar miller619 commented on June 21, 2024

Yea.. like get the phone number along with the country code to be saved into database, shared preference, etc. Because the controller only returns the number and not the country code.

from intl_phone_number_input.

natintosh avatar natintosh commented on June 21, 2024

ok. So to updated the input and the country code selected just use setState on the initialValue, which accepts a phone number and iso code. I hope this helps

from intl_phone_number_input.

miller619 avatar miller619 commented on June 21, 2024

please take a look at this

const InternationalPhoneNumberInput({ Key key, this.selectorType, @required this.onInputChanged, this.onInputValidated, this.focusNode, this.textFieldController, this.onSubmit, this.keyboardAction, this.countries, this.textStyle, this.inputBorder, this.inputDecoration, this.searchBoxDecoration, this.initialCountry2LetterCode = 'NG', this.hintText = 'Phone Number', this.isEnabled = true, this.autoValidate = false, this.formatInput = true, this.errorMessage = 'Invalid phone number', this.ignoreBlank = false, this.locale, }) : super(key: key);

There is no initialValue in the constructor.

from intl_phone_number_input.

natintosh avatar natintosh commented on June 21, 2024

It seems you are using a previous version of the package, please update it to the latest version intl_phone_number_input: ^0.4.2

from intl_phone_number_input.

miller619 avatar miller619 commented on June 21, 2024

Updated. Now i have initialValue in constructor but still cannot get the value. Tried following your example again and again. Not leading me anywhere. I keep getting only the phone number without the coutrycode.

from intl_phone_number_input.

inkersgithub avatar inkersgithub commented on June 21, 2024

I used the onInputChanged event as below

PhoneNumber phoneNumber;
.
.
InternationalPhoneNumberInput(
  .
  .
  onInputChanged: (number) {
      setState(() {
          phoneNumber = number;
      });
   },
   .
)

void someFunction(){
     print(phoneNumber.dialCode);
}

from intl_phone_number_input.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.