【问题标题】:how to achieve the below widget in flutter? [closed]如何在颤动中实现以下小部件? [关闭]
【发布时间】:2020-05-23 07:20:11
【问题描述】:

我无法在电话号码的文本字段中附加国家/地区代码和国家/地区标志 我是新手,所以我需要逐步说明。谢谢 我想要和图片一样

【问题讨论】:

  • 这实际上是两个控件,没有别的,所以你也可以自己做,否则如果你不能,我可以帮助
  • 我没有得到这样做的逻辑。
  • 在左侧使用下拉菜单并在该文本字段旁边使用
  • 是的,我知道,但我在编码方面做不到
  • 试试这个library

标签: flutter


【解决方案1】:

你可以这样做:

Padding(
  padding: const EdgeInsets.all(8.0),
  child: Card(
      child: Padding(
         padding: const EdgeInsets.all(8.0),
         child: Row(
           children: [
              Icon(Icons.flag),
              SizedBox(width: 5),
              Text("+91"),
              SizedBox(width: 20),
              Expanded(
                child: TextFormField(
                   decoration: InputDecoration(
                      border: InputBorder.none,
                      hintText: "Enter your mobile number",
            )
           ],
          ),
         ),
        ),
       )

最终的结果是这样的:

您可以将小部件Icon 替换为Image 并使用正确的标志。

【讨论】:

    猜你喜欢
    • 2021-04-09
    • 1970-01-01
    • 1970-01-01
    • 2021-08-03
    • 2021-09-07
    • 1970-01-01
    • 2021-09-22
    • 2019-09-08
    • 1970-01-01
    相关资源
    最近更新 更多