flutter - TextFormField 通过适当的对齐增加高度
问题描述
我正在努力让我TextFormField
的“更大”。我试过这段代码,它确实让它变大了,但如果我输入(这里:qwerty)它从中间开始。有没有从左上角开始的选项?
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Container(
width: screenWidth / 1.1,
height: screenHeight / 5.5,
child: Form(
key: _form2Key,
autovalidate: true,
child: TextFormField(
validator: (val) {
if (val.trim().length > 200) {
return "Beschrijving te lang";
} else {
return null;
}
},
onSaved: (val) => beschrijving = val,
minLines: null,
maxLines: null,
expands: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
filled: true,
fillColor: Colors.white,
labelText: "",
labelStyle: TextStyle(fontSize: 15.0),
hintText: " ",
),
),
),
),
)
解决方案
你可以试试这个。
Padding(
padding: EdgeInsets.all(8.0),
child: Container(
width: 400,
height: 120,
child: Form(
autovalidate: true,
child: TextFormField(
autofocus: true,
validator: (val) {
if (val.trim().length > 200)
return "Beschrijving te lang";
else
return null;
},
maxLines: 100,
decoration: InputDecoration(
border: OutlineInputBorder(),
filled: true,
fillColor: Colors.white,
labelText: "",
labelStyle: TextStyle(fontSize: 15.0),
hintText: "Enter a message",
),
),
),
),
)
输出:
推荐阅读
- python-3.x - 在 Dash 回调的输入中使用了不存在的对象
- python - 如何展平多级熊猫 DF?
- spring-boot - Springboot gzip压缩-响应大小不减小
- f# - 使用 FParsec 跳过空格和注释
- android - 禁用 InjectMappingFiledId 任务
- c++ - C++ 实用程序::conversions 在静态链接库中不起作用
- git - Jenkins 管道:如何在不启动 shell 的情况下检查远程分支
- c++ - 修复取决于预处理器条件的“-Wunused-parameter”警告
- r - 计算具有相同值的几列的百分比
- python-3.x - 如何在我的脚本意外重复之前搜索我的 anki 套牌?