mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-25 15:27:56 +00:00
add table view
This commit is contained in:
@@ -34,7 +34,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
TextEditingController();
|
||||
final TextEditingController forgetOtp = TextEditingController();
|
||||
final forgetFormKey = GlobalKey<FormState>();
|
||||
late bool checkValidate = false;
|
||||
late bool checkValidate = false;
|
||||
|
||||
Timer? _timer;
|
||||
int _remainingTime = 0;
|
||||
@@ -58,8 +58,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
add(const UpdateTimerEvent(remainingTime: 0, isButtonEnabled: true));
|
||||
} else {
|
||||
add(UpdateTimerEvent(
|
||||
remainingTime: _remainingTime,
|
||||
isButtonEnabled: false));
|
||||
remainingTime: _remainingTime, isButtonEnabled: false));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -152,29 +151,35 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
key: UserModel.userUuidKey,
|
||||
value: Token.decodeToken(token.accessToken)['uuid'].toString());
|
||||
user = UserModel.fromToken(token);
|
||||
debugPrint(token.accessToken);
|
||||
loginEmailController.clear();
|
||||
loginPasswordController.clear();
|
||||
emit(LoginSuccess());
|
||||
} else {
|
||||
|
||||
emit(const LoginFailure(error: 'Something went wrong'));
|
||||
}
|
||||
} else {
|
||||
|
||||
emit(const LoginFailure(error: 'Accept terms and condition'));
|
||||
}
|
||||
}
|
||||
|
||||
checkBoxToggle(CheckBoxEvent event, Emitter<AuthState> emit,) {
|
||||
checkBoxToggle(
|
||||
CheckBoxEvent event,
|
||||
Emitter<AuthState> emit,
|
||||
) {
|
||||
emit(AuthLoading());
|
||||
isChecked = event.newValue!;
|
||||
add(CheckEnableEvent());
|
||||
emit(LoginInitial());
|
||||
}
|
||||
|
||||
checkOtpCode(ChangePasswordEvent event, Emitter<AuthState> emit,) async {
|
||||
checkOtpCode(
|
||||
ChangePasswordEvent event,
|
||||
Emitter<AuthState> emit,
|
||||
) async {
|
||||
emit(LoadingForgetState());
|
||||
await AuthenticationAPI.verifyOtp(email: forgetEmailController.text, otpCode: forgetOtp.text);
|
||||
await AuthenticationAPI.verifyOtp(
|
||||
email: forgetEmailController.text, otpCode: forgetOtp.text);
|
||||
emit(SuccessForgetState());
|
||||
}
|
||||
|
||||
@@ -202,19 +207,17 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
} else if (regionUuid == '') {
|
||||
return 'Please select your region';
|
||||
}
|
||||
validate='';
|
||||
validate = '';
|
||||
return null;
|
||||
}
|
||||
|
||||
String? loginValidateEmail(String? value) {
|
||||
if (!RegExp(r'^[^@]+@[^@]+\.[^@]+').hasMatch(value!)) {
|
||||
if (!RegExp(r'^[^@]+@[^@]+\.[^@]+').hasMatch(value!)) {
|
||||
return '';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool _validateInputs(Emitter<AuthState> emit) {
|
||||
emit(LoadingForgetState());
|
||||
final nameError = validateEmail(forgetEmailController.text);
|
||||
@@ -357,7 +360,9 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
final String formattedTime = [
|
||||
if (days > 0) '${days}d', // Append 'd' for days
|
||||
if (days > 0 || hours > 0)
|
||||
hours.toString().padLeft(2, '0'), // Show hours if there are days or hours
|
||||
hours
|
||||
.toString()
|
||||
.padLeft(2, '0'), // Show hours if there are days or hours
|
||||
minutes.toString().padLeft(2, '0'),
|
||||
seconds.toString().padLeft(2, '0'),
|
||||
].join(':');
|
||||
@@ -365,9 +370,12 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
return formattedTime;
|
||||
}
|
||||
|
||||
bool checkEnable( CheckEnableEvent event, Emitter<AuthState> emit,) {
|
||||
bool checkEnable(
|
||||
CheckEnableEvent event,
|
||||
Emitter<AuthState> emit,
|
||||
) {
|
||||
emit(AuthLoading());
|
||||
checkValidate = isChecked==true &&
|
||||
checkValidate = isChecked == true &&
|
||||
loginPasswordController.text.isNotEmpty &&
|
||||
loginEmailController.text.isNotEmpty &&
|
||||
regionUuid != '';
|
||||
@@ -375,14 +383,21 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
return checkValidate;
|
||||
}
|
||||
|
||||
changeValidate(ChangeValidateEvent event, Emitter<AuthState> emit,){
|
||||
changeValidate(
|
||||
ChangeValidateEvent event,
|
||||
Emitter<AuthState> emit,
|
||||
) {
|
||||
emit(AuthLoading());
|
||||
validate='';
|
||||
validate = '';
|
||||
emit(LoginInitial());
|
||||
}
|
||||
changeForgetValidate(ChangeValidateEvent event, Emitter<AuthState> emit,){
|
||||
|
||||
changeForgetValidate(
|
||||
ChangeValidateEvent event,
|
||||
Emitter<AuthState> emit,
|
||||
) {
|
||||
emit(AuthLoading());
|
||||
forgetValidate='';
|
||||
forgetValidate = '';
|
||||
emit(LoginInitial());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user