flutter Row嵌套TextField出错

flutter开发中遇到需求需要Row嵌套TextField,运行后发现代码报错:

child: Row(
   children: [
       TextField(
          decoration: InputDecoration(
              hintText: "名称"
          ),
       )
    ],
),

错误码太多了,这里就不贴出来了。

   child: Row(
          children: [
            Expanded(
              child:TextField(
                  decoration: InputDecoration(
                     hintText: "名称"
                  ),
               )
            )
             
          ],
        ),

使用Expanded嵌套一层后就不报错了,为了可以对TextField进行位置设置,我又在Expanded外套了一层Container。

posted @   hczhhm  阅读(116)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 本地部署 DeepSeek:小白也能轻松搞定!
· 如何给本地部署的DeepSeek投喂数据,让他更懂你
· 从 Windows Forms 到微服务的经验教训
· 李飞飞的50美金比肩DeepSeek把CEO忽悠瘸了,倒霉的却是程序员
· 超详细,DeepSeek 接入PyCharm实现AI编程!(支持本地部署DeepSeek及官方Dee
点击右上角即可分享
微信分享提示