浏览代码

[new]登录输入框增加限制以及优化键盘弹窗类型

zk 1 年之前
父节点
当前提交
c92e57cbac
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      lib/module/login/view.dart

+ 7 - 0
lib/module/login/view.dart

@@ -97,10 +97,14 @@ class LoginPage extends BasePage<LoginController> {
       child: TextField(
         focusNode: controller.phoneFocusNode,
         maxLines: 1,
+        maxLength: 11,
+        cursorColor: ColorName.colorPrimary,
+        keyboardType: TextInputType.phone,
         textAlignVertical: TextAlignVertical.center,
         textInputAction: TextInputAction.next,
         decoration: InputDecoration(
           hintText: '输入手机号码',
+          counterText: '',
           hintStyle: TextStyle(fontSize: 16, color: "#AFAFAF".toColor()),
           labelStyle: const TextStyle(
             fontSize: 16,
@@ -138,6 +142,9 @@ class LoginPage extends BasePage<LoginController> {
             child: TextField(
               maxLines: 1,
               maxLength: 4,
+              keyboardType: TextInputType.number,
+              inputFormatters: [FilteringTextInputFormatter.digitsOnly],
+              cursorColor: ColorName.colorPrimary,
               textAlignVertical: TextAlignVertical.center,
               textInputAction: TextInputAction.done,
               decoration: InputDecoration(