尝试在 BottomAppBar 中嵌入 TextField 或 TextFormField

问题描述

我正在尝试构建一个包含几个图标(左侧两个,右侧两个)的 BottomAppBar,我想在它们之间添加一个文本输入字段,但无论我尝试什么,它都没有不行。

代码编译正常,但打开使用此小部件的页面时,现在出现以下错误

RenderBox 没有布局:RenderRepaintBoundary#bcb66 NEEDS-LAYOUT NEEDS-PAINT

这是我的代码

Widget _buildBottomNavBar(){
  return BottomAppBar(
    child: Row(
      children:
      [
        IconButton(icon: Icon(Icons.attach_file_rounded),onpressed: () {}),IconButton(icon: Icon(Icons.emoji_emotions_outlined),TextFormField(
          decoration: Inputdecoration(labelText: 'Message'),),IconButton(icon: Icon(Icons.play_arrow_rounded),IconButton(icon: Icon(Icons.undo_rounded),],);
}

这看起来很简单,但我尝试了多种方法包括将 TextFormField 包装在一个展开的小部件中),但似乎没有任何效果。任何有用的想法都非常感谢。 tia

更新(这里是固定代码,忘记加子了:)

Widget _buildBottomNavBar(){
  return BottomAppBar(
    child: Row(
      children:
      [
        IconButton(icon: Icon(Icons.attach_file_rounded),Expanded(child:
        TextFormField(
          decoration: Inputdecoration(labelText: 'Message'),)),);
}

顺便说一句,请原谅我糟糕的缩进。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)