Browse Source

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

zk 1 year ago
parent
commit
c92e57cbac
1 changed files with 7 additions and 0 deletions
  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(
       child: TextField(
         focusNode: controller.phoneFocusNode,
         focusNode: controller.phoneFocusNode,
         maxLines: 1,
         maxLines: 1,
+        maxLength: 11,
+        cursorColor: ColorName.colorPrimary,
+        keyboardType: TextInputType.phone,
         textAlignVertical: TextAlignVertical.center,
         textAlignVertical: TextAlignVertical.center,
         textInputAction: TextInputAction.next,
         textInputAction: TextInputAction.next,
         decoration: InputDecoration(
         decoration: InputDecoration(
           hintText: '输入手机号码',
           hintText: '输入手机号码',
+          counterText: '',
           hintStyle: TextStyle(fontSize: 16, color: "#AFAFAF".toColor()),
           hintStyle: TextStyle(fontSize: 16, color: "#AFAFAF".toColor()),
           labelStyle: const TextStyle(
           labelStyle: const TextStyle(
             fontSize: 16,
             fontSize: 16,
@@ -138,6 +142,9 @@ class LoginPage extends BasePage<LoginController> {
             child: TextField(
             child: TextField(
               maxLines: 1,
               maxLines: 1,
               maxLength: 4,
               maxLength: 4,
+              keyboardType: TextInputType.number,
+              inputFormatters: [FilteringTextInputFormatter.digitsOnly],
+              cursorColor: ColorName.colorPrimary,
               textAlignVertical: TextAlignVertical.center,
               textAlignVertical: TextAlignVertical.center,
               textInputAction: TextInputAction.done,
               textInputAction: TextInputAction.done,
               decoration: InputDecoration(
               decoration: InputDecoration(