GithubHelp home page GithubHelp logo

Comments (3)

vanshg395 avatar vanshg395 commented on August 23, 2024 2

Added.

from intl_phone_field.

vanshg395 avatar vanshg395 commented on August 23, 2024 1

well, this feature can be quite usefull. Though it can be implemented using controllers, but still if you want it to be available like initialValue argument, you can send a PR.

from intl_phone_field.

Technorocker avatar Technorocker commented on August 23, 2024

This feature was added but I'm having one hell of a time trying to populate this value when I load my widget. I'm grabbing the mobile number successfully using the mobile_number plugin and when I try to use that variable with the number stored it doesnt show up. I have also tried to use storage saved values when I call the getMobile method and then calling the saved value when the widget loads still no luck

Having said that when I do a restart in vscode the widget updates and the number fills in. I have then implemented the use of GetX using obs on the value and Obx method wrapped around intlPhoneField but its still not filling the input box.

Here is the widget portion...

child: Obx(
              () => IntlPhoneField(
                dropdownIcon: Icon(
                  Icons.arrow_drop_down,
                  color: Theme.of(context).colorScheme.secondary,
                ),
                //controller: phoneController,
                onChanged: (phone) {
                  print(phone.completeNumber);
                  print(phone.countryCode);
                  print(phone.number);
                },
                cursorColor: Theme.of(context).colorScheme.secondary,
                cursorWidth: 3.sp,
                keyboardType: TextInputType.number,
                **initialValue: permController.coreMobileNumber.value,**
                dropdownTextStyle: TextStyle(
                    color: Theme.of(context).colorScheme.secondary,
                    fontWeight: FontWeight.bold,
                    fontSize: 15.sp,
                    letterSpacing: 1.2.sp),

and here is the method I'm using to grab the mobile number...

  final coreMobileNumber = ''.obs;
  Future<void> getMobileNumber() async {
    final completeNumber = await MobileNumber.mobileNumber;
    var properNumber = '';
    if (completeNumber != null) {
      properNumber = completeNumber.substring(completeNumber.length - 10);
    }
    coreMobileNumber.value = properNumber;
    Storage.saveValue('mobileNumber', properNumber);
  }

any help using this feature would be much appreciated

from intl_phone_field.

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.