我想在文本字段上创建一个保持固定位置的标签。我的手机上有一个应用程序,其标签如下所示,我正在尝试设计类似的东西:
正如所见,无论是否有人在字段中键入,标签总是固定在位置上。我在当前代码中输入“Jay”,Customer Contact Field
标签从字段内开始,然后移动到悬挂在边界处。或者也许颤振是不可能的?
child:TextField(
decoration: InputDecoration(
labelText: 'Customer Contact')),
Run Code Online (Sandbox Code Playgroud)
您可以将Text和添加TextField到Column小部件中来实现此目的:
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text('Customer Contact', textAlign: TextAlign.left),
TextField(
cursorColor: Colors.white,
decoration: InputDecoration(hintText: 'Enter here'),
)
],
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13051 次 |
| 最近记录: |