TLNumberTextField constructor

TLNumberTextField({
  1. Key? key,
  2. String? defaultValue,
  3. String? hintText,
  4. int? maxLength,
  5. int? maxIntegerLength,
  6. int? maxDecimalLength,
  7. TextStyle? style,
  8. TextStyle? hintStyle,
  9. TextAlign? textAlign,
  10. TextInputType? keyboardType = const TextInputType.numberWithOptions(decimal: true),
  11. List<TextInputFormatter>? inputFormatters,
  12. dynamic onChange(
    1. String
    )?,
  13. bool enable = true,
  14. dynamic onSubmit(
    1. String
    )?,
  15. FocusNode? focusNode,
  16. EdgeInsetsGeometry? contentPadding,
  17. InputBorder? border,
  18. InputBorder? enableBorder,
  19. InputBorder? disableBorder,
  20. InputBorder? focusBorder,
  21. dynamic onDispose()?,
  22. dynamic onFocusChange(
    1. bool
    )?,
  23. InputDecoration? inputDecoration,
})

Implementation

TLNumberTextField({
  Key? key,
  String? defaultValue,
  String? hintText,
  int? maxLength,
  int? maxIntegerLength,
  int? maxDecimalLength,
  TextStyle? style,
  TextStyle? hintStyle,
  TextAlign? textAlign,
  TextInputType? keyboardType = const TextInputType.numberWithOptions(decimal: true),
  List<TextInputFormatter>? inputFormatters,
  Function(String)? onChange,
  bool enable = true,
  Function(String)? onSubmit,
  FocusNode? focusNode,
  EdgeInsetsGeometry? contentPadding,
  InputBorder? border,
  InputBorder? enableBorder,
  InputBorder? disableBorder,
  InputBorder? focusBorder,
  final Function()? onDispose,
  final Function(bool)? onFocusChange,
  final InputDecoration? inputDecoration,
}) : super(
        key: key,
        defaultValue: defaultValue,
        hintText: hintText,
        maxLength: maxLength,
        style: style,
        hintStyle: hintStyle,
        textAlign: textAlign,
        keyboardType: keyboardType,
        inputFormatters: inputFormatters ??
            [
              //文本长度限制
              LengthLimitingTextInputFormatter(maxLength),
              //只允许输入小数
              FilteringTextInputFormatter.allow(RegExp("[0-9.]")),
              //FilteringTextInputFormatter.allow(RegExp("[0-9.]")),但这种限制会有问题,比如可以输入0.1.1这种其实就不是小数了,并且不能限制小数点的输入位数。
              TLNumberTextInputFormatter(maxIntegerLength: maxIntegerLength, maxDecimalLength: maxDecimalLength, isAllowDecimal: true),
            ],
        onChange: onChange,
        enable: enable,
        onSubmit: onSubmit,
        focusNode: focusNode,
        contentPadding: contentPadding,
        border: border,
        enableBorder: enableBorder,
        disableBorder: disableBorder,
        focusBorder: focusBorder,
        onDispose: onDispose,
        onFocusChange: onFocusChange,
        inputDecoration: inputDecoration
      );