diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index 220fdbe..8a2555e 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -46,6 +46,7 @@ class _LoginPageState extends State { // _phone = '12345678909'; } + String ploneText = ""; @override Widget build(BuildContext context) { return CloudScaffold( @@ -89,11 +90,13 @@ class _LoginPageState extends State { style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)), ), 80.hb, - _getBox('+86', 36), - _getBox('验证码', 32), + _getBox('+86', 36, "请输入手机号", 11), + _getBox('验证码', 32, "请输入验证码", 6), 112.hb, PloneBottom( blM: false, + border: ploneText.length != 11, + opacity: ploneText.length == 11 ? 1 : 0.4, onTap: () { Get.to(() => const TabNavigator()); }, @@ -107,7 +110,7 @@ class _LoginPageState extends State { ); } - _getBox(String text, int fontSize) { + _getBox(String text, int fontSize, String hit, int num) { return Container( height: 144.w, width: double.infinity, @@ -135,28 +138,32 @@ class _LoginPageState extends State { margin: EdgeInsets.symmetric(horizontal: 32.w), color: const Color(0xFFE8E8E8), ), - _phoneTFWidget(), + _phoneTFWidget(hit, num), ]), ); } // 输入手机号 - _phoneTFWidget() { + _phoneTFWidget(String hit, int num) { return SizedBox( // alignment: Alignment.centerLeft, // padding: EdgeInsets.symmetric(horizontal: 72.w), width: 300.w, height: 50.w, child: TextField( - maxLength: 11, + maxLength: num, inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))], textCapitalization: TextCapitalization.none, + onChanged: (text) { + ploneText = text; + setState(() {}); + }, decoration: InputDecoration( contentPadding: EdgeInsets.only(bottom: 20.w), border: InputBorder.none, counterText: "", //textfield占位语,类似于iOS中的placeholder - hintText: "请输入手机号", + hintText: hit, //占位语颜色 hintStyle: TextStyle(color: Colors.black12), ),