Flutter——TextField会出现文字向下偏移不会水平居中的问题

 

 

 

TextField中文字和两边的icon都不对齐,文字整体向下偏移,查阅了大量文案,给出的解决方案大致是:
              TextField(                                
                decoration: InputDecoration(
                  contentPadding: EdgeInsets.all(0),
                    border: InputBorder.none,
                    hintText: hintText),
              ),

即:

在 InputDecoration里面加入

border: InputBorder.none

或者

border: OutlineInputBorder(
  borderSide: BorderSide.none
)

两种方案有的有效,有的却是无效,不妨都可以试试

(  反正我的是没生效😿  ) 

 

推荐文章:https://blog.csdn.net/qq_35547137/article/details/109367095

        https://blog.csdn.net/u012063213/article/details/107715508

posted on 2021-06-08 11:39  在一起的浅蓝色  阅读(1220)  评论(0编辑  收藏  举报

导航