Home > Net >  How to add done button on numeric keyboard in ios flutter
How to add done button on numeric keyboard in ios flutter

Time:11-01

I am using Textformfield in flutter it is working fine in android but not in IOS , in IOS need done button . I want to display a numeric keyboard with done button in IOS. Here is my code ..

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

CodePudding user response:

You just need to add

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

CodePudding user response:

I think the code below is the only solution for that:

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