flutter TextField会出现文字向下偏移不会水平居中的问题
在需求里面需要取消默认下部边框 网上的帖子都是说这样TextField(style: TextStyle(fontSize: 38.sp),controller: _textEditingController,onChanged: onChanged,autofocus: false,keyboardT..
·
在需求里面需要取消默认下部边框 网上的帖子都是说这样
TextField(
style: TextStyle(fontSize: 38.sp),
controller: _textEditingController,
onChanged: onChanged,
autofocus: false,
keyboardType: keyboardType,
textAlign: TextAlign.right,
// strutStyle: StrutStyle(height: 20.h),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
border: InputBorder.none,
hintText: hintText),
),
在 InputDecoration里面加入
border: InputBorder.none, 就可以了
但是我发现这样会导致输入文字下移(自己的项目中会这样,其他人的不保证)
后来自己无意中发现 把 border: InputBorder.none 改成
border: OutlineInputBorder( borderSide: BorderSide.none )
就显示正常了
自己记录下 免得以后出现同样的问题
更多推荐
已为社区贡献2条内容
所有评论(0)