56 lines
2.0 KiB
Dart
Executable File
56 lines
2.0 KiB
Dart
Executable File
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;
|
|
RxBool canSendCode = 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 && pwd.value.length >= 8 && surePwd.value.length >= 8;
|
|
bool get codeIsOK => verificationCode.value.isNotEmpty && verificationCode.value.length >= 6 ;
|
|
|
|
RxBool canResend = false.obs;// 是否能重新发送,就是验证码倒计时之后的重新发送
|
|
RxString btnText = ''.obs;
|
|
int totalSeconds = 120;
|
|
int currentSecond = 120;
|
|
RxMap<String, dynamic> deviceInfoMap = <String, dynamic>{}.obs;
|
|
|
|
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();
|
|
}
|
|
}
|