验证码纯数字键盘

hmxc
小赖 4 years ago
parent 10d89c668b
commit 51571d8798

@ -94,7 +94,8 @@ class _UpdateTelPageState extends State<UpdateTelPage> {
'新号码'.text.black.size(28.sp).make(),
TextFormField(
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9]*')),
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(11),
],
controller: _newTelController,
onChanged: (value) {
@ -147,8 +148,10 @@ class _UpdateTelPageState extends State<UpdateTelPage> {
'验证码'.text.black.size(28.sp).make(),
TextFormField(
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9]*'))
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(11),
],
keyboardType: TextInputType.number,
controller: _codeController,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,

@ -8,6 +8,7 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart' show TextUtil;
import 'package:flustars/flustars.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart' hide Response;
import 'package:power_logger/power_logger.dart';
@ -145,6 +146,7 @@ class _SignInPageState extends State<SignInPage> {
String hint,
Widget prefix,
Widget suffix,
TextInputType type = TextInputType.number,
TextEditingController controller,
}) {
return Container(
@ -160,6 +162,11 @@ class _SignInPageState extends State<SignInPage> {
prefix ?? SizedBox(),
20.wb,
TextField(
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(11),
],
keyboardType: type,
controller: controller,
onChanged: (_) => setState(() {}),
decoration: InputDecoration(
@ -230,6 +237,7 @@ class _SignInPageState extends State<SignInPage> {
),
26.hb,
_buildTextField(
type: TextInputType.number,
prefix: Image.asset(
R.ASSETS_IMAGES_CODE_LOGO_PNG,
height: 50.w,

Loading…
Cancel
Save