flutter 输入框限制输入汉字,数字,小数

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
    TextField(
          inputFormatters: [
                           WhitelistingTextInputFormatter(RegExp("[a-zA-Z]")),//只允许输入字母
          ],
   ),
    TextField(
          inputFormatters:[WhitelistingTextInputFormatter.digitsOnly],//只允许输入数字
   ),
    TextField(
          inputFormatters: [
                            WhitelistingTextInputFormatter(RegExp("[0-9.]")),//只允许输入小数
                          ],
    )

你可能感兴趣的:(flutter 输入框限制输入汉字,数字,小数)