flutter 如何在IntlPhoneField中右侧下拉箭头

ojsjcaue  于 2023-05-23  发布在  Flutter
关注(0)|答案(2)|浏览(198)

我试图在右侧设置下拉箭头,旁边的+92,但它没有发生。
这里是代码

Container(
                  width: MediaQuery.of(context).size.width * 0.80,
                  height: 50.0,
                  child: IntlPhoneField(
                    
                    showDropdownIcon: true,
                    decoration: InputDecoration(
                      
                      labelText: 'Phone Number',
                      border: OutlineInputBorder(
                          borderRadius:
                              BorderRadius.all(Radius.circular(10.0))),
                    ),
                    initialCountryCode: 'PK',
                    onChanged: (phone) {
                      print(phone.completeNumber);
                    },
                  )),

请帮助我如何做

zc0qhyus

zc0qhyus1#

试试下面的代码,希望我认为你的问题已经解决了,只是改变IconPositiontrailing而不是leading

Container(
      width: MediaQuery.of(context).size.width * 0.80,
      height: 50.0,
      child: IntlPhoneField(
        showDropdownIcon: true,
        iconPosition: IconPosition.trailing,
        decoration: InputDecoration(
          labelText: 'Phone Number',
          border: OutlineInputBorder(
              borderRadius: BorderRadius.all(Radius.circular(10.0))),
        ),
        initialCountryCode: 'PK',
        onChanged: (phone) {
          print(phone.completeNumber);
        },
      ),
    ),

我的Widget图像-> x1c 0d1x您的结果屏幕->

nukf8bse

nukf8bse2#

你可以用

Container(
  width: MediaQuery.of(context).size.width * 0.80,
  height: 50.0,
  child: IntlPhoneField(
    showDropdownIcon: true,
    dropdownIconPosition: IconPosition.trailing, // <= Use This ******
    decoration: InputDecoration(
      labelText: 'Phone Number',
      border: OutlineInputBorder(
          borderRadius: BorderRadius.all(Radius.circular(10.0))),
    ),
    initialCountryCode: 'PK',
    onChanged: (phone) {
      print(phone.completeNumber);
    },
  ),
),

相关问题