我已经添加了电话号码文本字段。.键盘将在第10个数字之后关闭。 iOS中的问题,如果输入10位数字...我试图删除一个数字..键盘保持紧密..无法删除..same在Android
TextEditingController controller = TextEditingController(text: "");
TextField(
textAlignVertical:
TextAlignVertical.center,
controller: controller,
maxLength: 10,
keyboardType: TextInputType.number,
color: color555A68,
hintStyle:
TextStyle(color: Color(0xFF8990A1)),
hintText: '8000080000',
)
void configureInitialCalls() {
if (controller.text.length >= 10) {
_closeKeyBoard();
}
});
void _closeKeyBoard() {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
}