app-starlock/star_lock/lib/login/register/starLock_register_logic.dart
2023-07-29 18:33:48 +08:00

53 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import '../../network/api_repository.dart';
import '../../tools/baseGetXController.dart';
import 'starLock_register_state.dart';
class StarLockRegisterLogic extends BaseGetXController{
final StarLockRegisterState state = StarLockRegisterState();
void register() async{
var entity = await ApiRepository.to.register(
state.countryCode.value,
state.countryId.value,
state.phoneOrEmailStr.value,
state.pwd.value,
"gdasdfasdfasdf",
state.verificationCode.value
);
if(entity.errorCode!.codeIsSuccessful){
await loginSuccess(loginEntity: entity);
} else {
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if(controller == state.phoneOrEmailController){
state.phoneOrEmailStr.value = controller.text;
}
if(controller == state.pwdController) {
state.pwd.value = controller.text;
}
if(controller == state.sureController) {
state.surePwd.value = controller.text;
}
if(controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub(){
state.canSub.value = state.pwdIsOK && state.codeIsOK && (state.isIphoneType.value ? state.isIphone : state.isEmail);
print("22222:${state.canSub.value}");
}
}