RK *_*ios 6 dart flutter textformfield flutter-textformfield
我需要更改文本表单字段内光标的位置。我设法将光标的高度减小 1,但光标的位置仍然位于顶部。我无法将其移动到底部。
我想实现这个目标:
但我实现的是:
Flutter 有没有办法做到这一点?
我的代码示例
TextFormField(
style: TextStyle(
color: Theme.of(context).textTheme.bodySmall?.color,
fontSize: 14,
),
minLines: 1,
maxLines: 1,
maxLength: 300,
cursorColor: Theme.of(context).hintColor,
textAlignVertical: TextAlignVertical.center,
cursorHeight: 1,
cursorWidth: 15,
);
Run Code Online (Sandbox Code Playgroud)
heightTextFormField 具有内部属性style- 您可以在高度上应用 0.0 来实现输出。也可以使用frombottom或padding ,这样您就可以应用或删除从光标到输入行从左上角到右下角的填充:topcontentPadding
return Scaffold(
appBar: AppBar(),
body: TextFormField(
style: TextStyle(
color: Theme.of(context).textTheme.bodySmall?.color,
fontSize: 26,
height: 0.0,
),
minLines: 1,
maxLength: 300,
cursorColor: Theme.of(context).hintColor,
textAlignVertical: TextAlignVertical.center,
cursorHeight: 1,
cursorWidth: 15,
decoration: const InputDecoration(
contentPadding: EdgeInsets.zero, border: InputBorder.none),
),
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
904 次 |
| 最近记录: |