如何在 phone 号码前设置国家代码?

How to set Country code before the phone number with flutter?

我正在尝试将国家代码放在 phone 号码之前。 我使用了 country_pickers 包,但我的代码出了点问题, 我的 TextField 的 hintText 可见性消失了,它什么也没显示

这是我的小部件

 Padding(
                      padding: const EdgeInsets.only(top: 5.0),
                        child:  new Container(
                          padding: const EdgeInsets.only(left: 10.0),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(5.0)),
                          border: Border.all(color: Colors.blue)
                        ),  
                        child: TextField(

                          keyboardType: TextInputType.phone,
                          decoration: InputDecoration(
                            border: InputBorder.none,
                            hintText: "Phone Number",
                            prefix:  CountryPickerDropdown(
                              initialValue: 'in',
                              itemBuilder: _buildDropdownItem,
                              onValuePicked: (Country country) {
                                print("${country.name}");
                              },
                            ),
                          ),
                          onChanged: (value){
                            this.phoneNo=value;
                          },

                        ),  
                      ),
                    ),

这是国家代码的小部件方法

Widget _buildDropdownItem(Country country) => Container(
        child: Row(
          children: <Widget>[
            CountryPickerUtils.getDefaultFlagImage(country),
            SizedBox(
              width: 8.0,
            ),
            Text("+${country.phoneCode}(${country.isoCode})"),
          ],
        ),
      );

正确的使用方法是在行小部件中。前缀在这里不起作用。

           Row(
               children: <Widget>[
                      Expanded(
                        child: CountryPickerDropdown(
                          initialValue: 'in',
                          itemBuilder: _buildDropdownItem,
                          onValuePicked: (Country country) {
                            print("${country.name}");
                          },
                        ),
                      ),
                      Expanded(
                        child: TextField(
                          keyboardType: TextInputType.phone,
                          decoration: InputDecoration(
                            border: InputBorder.none,
                            hintText: "Phone Number",
                          ),
                          onChanged: (value) {
                            // this.phoneNo=value;
                            print(value);
                          },
                        ),
                      ),
                    ],
                  ),