Commit 685e9641 authored by skeyboy's avatar skeyboy

登录页验证码倒计时/登录页禁用Android侧滑返回

parent b72d1fa9
...@@ -26,6 +26,7 @@ class SignInController extends GetxController { ...@@ -26,6 +26,7 @@ class SignInController extends GetxController {
RxBool codeEnable = false.obs; RxBool codeEnable = false.obs;
RxBool checkBox = false.obs; RxBool checkBox = false.obs;
RxBool loginBtnEable = false.obs; RxBool loginBtnEable = false.obs;
RxString codeTileStr = "获取验证码".obs;
/// 倒计时的计时器。 /// 倒计时的计时器。
late Timer _timer; late Timer _timer;
...@@ -176,11 +177,13 @@ class SignInController extends GetxController { ...@@ -176,11 +177,13 @@ class SignInController extends GetxController {
_seconds = 60; _seconds = 60;
verifyStr.value = '重新发送'; verifyStr.value = '重新发送';
codeEnable.value = true; codeEnable.value = true;
codeTileStr.value = "重新发送验证码";
return; return;
} }
_seconds--;
verifyStr.value = '已发送$_seconds' + 's'; verifyStr.value = '已发送$_seconds' + 's';
codeTileStr.value = "${_seconds}s后重试";
codeEnable.value = false; codeEnable.value = false;
_seconds--;
}); });
} }
......
...@@ -590,7 +590,9 @@ class SignInPage extends GetView<SignInController> { ...@@ -590,7 +590,9 @@ class SignInPage extends GetView<SignInController> {
} }
Widget buildAndroidSigin(BuildContext buildContext) { Widget buildAndroidSigin(BuildContext buildContext) {
return GestureDetector( return WillPopScope(onWillPop: () async{
return false;
},child: GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: () => Focus.of(buildContext).unfocus(), onTap: () => Focus.of(buildContext).unfocus(),
child: SingleChildScrollView( child: SingleChildScrollView(
...@@ -647,7 +649,7 @@ class SignInPage extends GetView<SignInController> { ...@@ -647,7 +649,7 @@ class SignInPage extends GetView<SignInController> {
cursorColor: kPrimaryColor, cursorColor: kPrimaryColor,
onSaved: (email) {}, onSaved: (email) {},
style: style:
const TextStyle(color: Color(0xFF6F35A5)), const TextStyle(color: Color(0xFF6F35A5)),
decoration: const InputDecoration( decoration: const InputDecoration(
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
fillColor: kPrimaryLightColor, fillColor: kPrimaryLightColor,
...@@ -655,15 +657,15 @@ class SignInPage extends GetView<SignInController> { ...@@ -655,15 +657,15 @@ class SignInPage extends GetView<SignInController> {
prefixIconColor: Color(0xFF6F35A5), prefixIconColor: Color(0xFF6F35A5),
filled: true, filled: true,
contentPadding: contentPadding:
EdgeInsets.fromLTRB(10, 10, 10, 10), EdgeInsets.fromLTRB(10, 10, 10, 10),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(30)), BorderRadius.all(Radius.circular(30)),
borderSide: BorderSide.none, borderSide: BorderSide.none,
), ),
hintText: "输入手机号", hintText: "输入手机号",
hintStyle: hintStyle:
TextStyle(color: Color(0xFF6F35A5)), TextStyle(color: Color(0xFF6F35A5)),
prefixIcon: Padding( prefixIcon: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: defaultPadding, left: defaultPadding,
...@@ -686,18 +688,18 @@ class SignInPage extends GetView<SignInController> { ...@@ -686,18 +688,18 @@ class SignInPage extends GetView<SignInController> {
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
fillColor: kPrimaryLightColor, fillColor: kPrimaryLightColor,
contentPadding: contentPadding:
EdgeInsets.fromLTRB(10, 10, 10, 10), EdgeInsets.fromLTRB(10, 10, 10, 10),
iconColor: Color(0xFF6F35A5), iconColor: Color(0xFF6F35A5),
prefixIconColor: Color(0xFF6F35A5), prefixIconColor: Color(0xFF6F35A5),
filled: true, filled: true,
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(30)), BorderRadius.all(Radius.circular(30)),
borderSide: BorderSide.none, borderSide: BorderSide.none,
), ),
hintText: "输入验证码", hintText: "输入验证码",
hintStyle: hintStyle:
TextStyle(color: Color(0xFF6F35A5)), TextStyle(color: Color(0xFF6F35A5)),
prefixIcon: Padding( prefixIcon: Padding(
padding: EdgeInsets.all(defaultPadding), padding: EdgeInsets.all(defaultPadding),
child: Icon(Icons.lock), child: Icon(Icons.lock),
...@@ -711,11 +713,11 @@ class SignInPage extends GetView<SignInController> { ...@@ -711,11 +713,11 @@ class SignInPage extends GetView<SignInController> {
Flexible(child: Container()), Flexible(child: Container()),
GestureDetector( GestureDetector(
onTap: () => controller.chageCodeStatus(), onTap: () => controller.chageCodeStatus(),
child: const Text( child: Obx(()=>Text(
"获取验证码", controller.codeTileStr.value,
style: TextStyle( style: const TextStyle(
color: Colors.white54, fontSize: 12), color: Colors.white54, fontSize: 12),
), )),
) )
], ],
), ),
...@@ -752,8 +754,7 @@ class SignInPage extends GetView<SignInController> { ...@@ -752,8 +754,7 @@ class SignInPage extends GetView<SignInController> {
), ),
), ),
), ),
); ),);
// return GestureDetector( // return GestureDetector(
// behavior: HitTestBehavior.translucent, // behavior: HitTestBehavior.translucent,
// onTap: () => FocusScope.of(buildContext).unfocus(), // onTap: () => FocusScope.of(buildContext).unfocus(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment