app-starlock/lib/login/register/starLock_register_state.dart
魏少阳 15af50d951 1、完善星锁APP国际化 36种语言。
2、修复国际化问题
2024-10-15 18:32:11 +08:00

53 lines
1.6 KiB
Dart
Executable File

import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.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;
RxMap<String, dynamic> deviceInfoMap = <String, dynamic>{}.obs;
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = '获取验证码'.tr;
}
void onClose() {
phoneOrEmailController.dispose();
pwdController.dispose();
sureController.dispose();
codeController.dispose();
}
}