How to create number input field in Flutter?

后端 未结 14 2108
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 21:47

I\'m unable to find a way to create an input field in Flutter that would open up a numeric keyboard. Is this possible with Flutter material widgets? Some github discussions

14条回答
  •  再見小時候
    2020-12-12 21:54

    Through this option you can strictly restricted another char with out number.

     inputFormatters: [FilteringTextInputFormatter.digitsOnly],
     keyboardType: TextInputType.number,
    

    For using above option you have to import this

    import 'package:flutter/services.dart';
    

    using this kind of option user can not paste char in a textfield

提交回复
热议问题