输入框输入时,需要将小写字母自动转大写,给 TextField 加一个 inputFormatters,
iPhone 上有个问题,输入中文会产生连续很多字母(就是说这种情况输入不了中文),所以加了底下 ① 这句代码
class UpperCaseTextFormatter extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
/// 判断当前输入框是否存在未完成的字符串
if (newValue.isComposingRangeValid) return newValue; /// ①
return TextEditingValue(
text: newValue.text.toUpperCase(),
selection: newValue.selection,
);
}
}
TextField(
inputFormatters: [UpperCaseTextFormatter()]
)
3 条评论
中和卖批一条街在哪里最热闹a0cz.cn
场景转换稍显突兀,可增加过渡描写。
《陷入麻烦的女孩》恐怖片高清在线免费观看:https://www.jgz518.com/xingkong/99413.html