import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../translations/trans_lib.dart'; class StarLockRegisterState { StarLockRegisterState() { resetResend(); } final TextEditingController phoneOrEmailController = TextEditingController(); final TextEditingController pwdController = TextEditingController(); final TextEditingController sureController = TextEditingController(); final TextEditingController codeController = TextEditingController(); RxString countryCode = '86'.obs; RxString countryName = '中国'.tr.obs; RxString phoneOrEmailStr = ''.obs; RxBool phoneOrEmailStrIsOK = false.obs; RxString pwd = ''.obs; RxString surePwd = ''.obs; RxString verificationCode = ''.obs; RxString xWidth = ''.obs; // 滑动验证码滑动位置 RxBool isIphoneType = true.obs; RxBool canSub = false.obs; RxBool agree = false.obs; bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty; bool get codeIsOK => verificationCode.value.isNotEmpty; RxBool canResend = false.obs; RxString btnText = ''.obs; int totalSeconds = 120; int currentSecond = 120; void resetResend() { canResend.value = totalSeconds == currentSecond; btnText.value = !canResend.value ? '$currentSecond s' : btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr; } void onClose() { phoneOrEmailController.dispose(); pwdController.dispose(); sureController.dispose(); codeController.dispose(); } }