我正在尝试构建一个聊天应用程序,其中“新消息”屏幕包含收件人和消息。我希望文本字段填满屏幕上的剩余空间,就像HTML中的Textarea一样。
- 我尝试将
maxLines
增加到一个很大的数字,这导致浮动操作按钮出现像素溢出错误。 - 我尝试使用
Expanded
小部件进行包装,但没有效果。
这是我当前的布局结构:
body: new Column(
children: <Widget>[
new ListTile(
dense: false,
title: new Text("Alex XYZ",
//...
),
Divider(),
new TextField(
decoration: InputDecoration(hintText: "Insert your message",),
scrollPadding: EdgeInsets.all(20.0),
autofocus: true,
)
],
),
在上述代码中,使用 TextField 时我甚至无法写多行。如果我添加 maxLines: 2 ,可以按 Enter 键向下移动,但这看起来不够清晰,而且在该区域内无法滚动。
希望有人能帮我扩展到整个屏幕。
最好的问候,Alex!