Flutter数字键盘,带有“完成”按钮,适用于iOS。

huangapple go评论73阅读模式
英文:

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,
)

huangapple
  • 本文由 发表于 2023年4月11日 02:03:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/75979532.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定