📜  只允许整数输入颤动 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:45.299000             🧑  作者: Mango

代码示例1
import 'package:flutter/services.dart';

new TextField(
    decoration: new InputDecoration(labelText: "Enter any number"),
    keyboardType: TextInputType.number,
    inputFormatters: [
        FilteringTextInputFormatter.digitsOnly
    ], // Only numbers can be entered in this input field
 ),