Home > Enterprise >  How to change font of country code? I am not abe to change country code font style in my ui. I am us
How to change font of country code? I am not abe to change country code font style in my ui. I am us

Time:06-22

image I am not abe to change country code font styl in my ui. I am using "intl_phone_field 3.1.0" this package. Here is my code

  Container(
                padding: EdgeInsets.all(20),
                child: Column(
                  children: <Widget>[
                    Container(
                        child: IntlPhoneField(
                      showCountryFlag: false,
                      showDropdownIcon: false,
                      keyboardType: TextInputType.number,
                      style: TextStyle(
                          color: Colors.grey,
                          fontFamily: 'DMSans',
                          fontSize: 20,
                          fontWeight: FontWeight.bold),
                      decoration: InputDecoration(
                          counterText: '', border: InputBorder.none),
                      initialCountryCode: 'IN',
                      onChanged: (phone) {
                        print(phone.completeNumber);
                        print(phone.countryCode);
                        print(phone.number);
                      },
                    )),
                  ],
                )),

CodePudding user response:

Use a variable for country code and assign it to initialCountryCode.

String countryISOCode = 'IN';

For country code text style, you can use.

dropdownTextStyle: TextStyle(),

Complete code.

 Container(
                      padding: EdgeInsets.all(20),
                      child: Column(
                        children: <Widget>[
                          Container(
                              child: IntlPhoneField(
                            showCountryFlag: false,
                            showDropdownIcon: false,
                            dropdownTextStyle: TextStyle(
                                color: Colors.grey,
                                fontFamily: 'DMSans',
                                fontSize: 25,
                                fontWeight: FontWeight.bold),
                            keyboardType: TextInputType.number,
                            style: TextStyle(
                                color: Colors.grey,
                                fontFamily: 'DMSans',
                                fontSize: 25,
                                fontWeight: FontWeight.bold),
                            decoration: InputDecoration(
                                counterText: '', border: InputBorder.none),
                            initialCountryCode: 'IN',
                            onChanged: (phone) {
                              print(phone.completeNumber);
                              print(phone.countryCode);
                              print(phone.number);
                            },
                          )),
                        ],
                      )),
  • Related