【问题标题】:How to dropdown arrow at right side in IntlPhoneField如何在 IntlPhoneField 右侧的下拉箭头
【发布时间】:2021-09-27 11:43:17
【问题描述】:

我正在尝试将下拉箭头设置在右侧,+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);
                    },
                  )),

请帮忙解决一下

【问题讨论】:

    标签: flutter textfield


    【解决方案1】:

    试试下面的代码希望我认为你的问题已经解决了只需将IconPosition改为trailing而不是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);
            },
          ),
        ),
    

    还有我的小部件图片 -> 您的结果屏幕->

    【讨论】:

    • 但是IntlPhoneField中没有iconposition的属性
    • 你试试我的代码吗?
    • 这段代码在我的机器上运行试试我的答案我已经附加了我的屏幕输出
    • 是的,试过 urs,在图标位置上出现错误
    • 你用哪个版本的flutter
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-13
    相关资源
    最近更新 更多