英文:
Flutter number keyboard with 'Done' for iOS
问题
文本表单字段(TextFormField):
键(key): Key(keyValue),
初始值(initialValue): valueBuilder,
保存时操作(onSaved): (text) {
},
输入格式化器(inputFormatters): [inputFormatters],
键盘类型(keyboardType): TextInputType.number,)
我也尝试过
键盘类型(keyboardType): TextInputType.numberWithOptions(signed: true, decimal: true)
但也没有生效。
英文:
TextFormField(
key: Key(keyValue),
initialValue: valueBuilder,
onSaved: (text) {
},
inputFormatters: [inputFormatters],
keyboardType: TextInputType.number,)
I also tried
keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true)
but it was not working too.
答案1
得分: 1
只需添加以下代码行,它将适用于您:
TextFormField(
.....
keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true), // 或者 keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
)
英文:
You just need to add following line and it will work for you
TextFormField(
.....
keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true), // OR keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论