在需求里面需要取消默认下部边框   网上的帖子都是说这样

              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
)

就显示正常了       

 

自己记录下 免得以后出现同样的问题

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐