mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-24 07:47:55 +00:00
fix this
17. The door lock/create password the screen, save button will create a pass as much the user click on the save button and Fixed the time being displayed incorrectly in DoorDialog
This commit is contained in:
@@ -18,6 +18,7 @@ class SmartDoorBloc extends Bloc<SmartDoorEvent, SmartDoorState> {
|
||||
final String deviceId;
|
||||
late SmartDoorModel deviceStatus;
|
||||
static String pageType = '';
|
||||
bool isSavingPassword = false;
|
||||
|
||||
SmartDoorBloc({required this.deviceId}) : super(InitialState()) {
|
||||
on<InitialEvent>(_fetchSmartDoorStatus);
|
||||
@@ -198,8 +199,9 @@ class SmartDoorBloc extends Bloc<SmartDoorEvent, SmartDoorState> {
|
||||
}
|
||||
|
||||
Future<void> savePassword(SavePasswordEvent event, Emitter<SmartDoorState> emit) async {
|
||||
if (_validateInputs()) return;
|
||||
if (_validateInputs() || isSavingPassword) return;
|
||||
try {
|
||||
isSavingPassword = true;
|
||||
emit(LoadingSaveState());
|
||||
var res = await DevicesAPI.createPassword(
|
||||
pageType: pageType,
|
||||
@@ -220,9 +222,10 @@ class SmartDoorBloc extends Bloc<SmartDoorEvent, SmartDoorState> {
|
||||
Navigator.of(event.context).pop(true);
|
||||
CustomSnackBar.displaySnackBar('Save Successfully');
|
||||
emit(SaveState());
|
||||
} catch (_) {}
|
||||
} catch (_) {}finally {
|
||||
isSavingPassword = false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deletePassword(DeletePasswordEvent event, Emitter<SmartDoorState> emit) async {
|
||||
try {
|
||||
emit(LoadingInitialState());
|
||||
|
||||
Reference in New Issue
Block a user