【问题标题】:How to add done button on numeric keyboard in ios flutter如何在 ios Flutter 中的数字键盘上添加完成按钮
【发布时间】:2022-11-01 22:08:08
【问题描述】:

我在颤振中使用 Textformfield 它在 android 中运行良好,但在 IOS 中没有,在 IOS 中需要完成按钮。我想在 IOS 中显示带有完成按钮的数字键盘。 这是我的代码..

TextFormField(
      controller: inputminsto1,
      style: TextStyle(color: Color(0xFF070A28).withOpacity(0.50),fontFamily: 'OpenSans', fontSize:14),
      decoration: InputDecoration(
        //icon of text field
        //labelText: 'Mins',labelStyle: TextStyle(color: Color(0xFF070A28).withOpacity(0.50),fontFamily: 'OpenSans', fontSize:14), //label text of field
        filled: true,
        fillColor: Color(0xFFF6F6F6),
        border: InputBorder.none,
        hintText: 'Mins',
        hintStyle: TextStyle(color: Color(0xFF070A28).withOpacity(0.50),fontFamily: 'OpenSans', fontSize:14),

      ),
      validator: (value) {
        if (value!.isEmpty) {
          return 'Required *';
        }
        return null;
      },
      textInputAction: TextInputAction.done,
      inputFormatters: <TextInputFormatter>[
        LengthLimitingTextInputFormatter(3),
        FilteringTextInputFormatter.digitsOnly,
        FilteringTextInputFormatter.deny(
            RegExp(r'\s'))
      ], // Only numbers can be entered
    ),

【问题讨论】:

    标签: ios flutter dart


    【解决方案1】:

    你只需要添加

    keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true)
    

    【讨论】:

      【解决方案2】:

      我认为下面的代码是唯一的解决方案:

      keyboardType:TextInputType.numberWithOptions(signed: true, decimal: true)
      

      【讨论】:

        猜你喜欢
        • 2013-12-10
        • 2019-04-29
        • 2016-03-19
        • 2021-07-20
        • 2012-04-22
        • 2023-03-15
        • 2011-05-20
        • 2010-10-09
        • 2013-09-21
        相关资源
        最近更新 更多