如何使Textfield Hinttext垂直中心?
我尝试了很多方法。
textAlign:TextAlign.Center
contentPadding: const EdgeInsets.all(20.0)
但它们没有用。
Expanded(
child: Container(
height: 30.0,
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius: BorderRadius.circular(18),
),
margin: const EdgeInsets.symmetric(vertical: 0, horizontal: 10.0),
child: const TextField(
style: TextStyle(fontSize: 14.0),
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入搜索词',
hintStyle: TextStyle(fontSize: 13.0),
prefixIcon: Icon(
Icons.search,
size: 18.0,
color: Colors.grey,
),
suffixIcon: Icon(
Icons.clear,
size: 18.0,
color: Colors.grey,
),
),
),
),
),
i tried many methods.
textAlign: TextAlign.Center
contentPadding: const EdgeInsets.all(20.0)
but they are useless.
Expanded(
child: Container(
height: 30.0,
decoration: BoxDecoration(
color: Colors.grey[100],
borderRadius: BorderRadius.circular(18),
),
margin: const EdgeInsets.symmetric(vertical: 0, horizontal: 10.0),
child: const TextField(
style: TextStyle(fontSize: 14.0),
decoration: InputDecoration(
border: InputBorder.none,
hintText: '请输入搜索词',
hintStyle: TextStyle(fontSize: 13.0),
prefixIcon: Icon(
Icons.search,
size: 18.0,
color: Colors.grey,
),
suffixIcon: Icon(
Icons.clear,
size: 18.0,
color: Colors.grey,
),
),
),
),
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下代码,使用
textAlign:textalign.center,
结果屏幕 - >
Try below code, use
textAlign: TextAlign.center,
Result screen->