【发布时间】:2021-03-03 05:38:10
【问题描述】:
我有带有文本字段的颤振应用程序。我需要像这张图片一样将标签放置在边框上方。
我有两个选择:
1.把它完全写成一个新的小部件
2.使用TextFormField + InputDecoration
我尝试了第二种方式,这是我的代码:
TextFormField(
controller: _controller,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: AppColors.borderColor, width: 1.0),
),
floatingLabelBehavior: FloatingLabelBehavior.always,
labelText: widget.hint
));
但我无法达到预期的效果。 这是可能的还是只有选项 1?
【问题讨论】:
-
为什么不在
TextFormField上方添加另一个text小部件,这样会更轻松
标签: flutter dart flutter-layout flutter-widget