mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Implement a countdown timer for the AC and fix bugs in the 'Forgot Password'
This commit is contained in:
@ -2,8 +2,9 @@ import 'package:equatable/equatable.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/ac/model/ac_model.dart';
|
||||
|
||||
abstract class AcsState extends Equatable {
|
||||
const AcsState();
|
||||
final bool isTimerActive;
|
||||
|
||||
const AcsState({this.isTimerActive = false});
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
@ -15,8 +16,30 @@ class AcsLoadingState extends AcsState {}
|
||||
class ACStatusLoaded extends AcsState {
|
||||
final AcStatusModel status;
|
||||
final DateTime timestamp;
|
||||
final int scheduledHours;
|
||||
final int scheduledMinutes;
|
||||
final bool isTimerActive;
|
||||
|
||||
ACStatusLoaded(this.status) : timestamp = DateTime.now();
|
||||
ACStatusLoaded({
|
||||
required this.status,
|
||||
this.scheduledHours = 0,
|
||||
this.scheduledMinutes = 0,
|
||||
this.isTimerActive = false,
|
||||
}) : timestamp = DateTime.now();
|
||||
ACStatusLoaded copyWith({
|
||||
AcStatusModel? status,
|
||||
int? scheduledHours,
|
||||
int? scheduledMinutes,
|
||||
bool? isTimerActive,
|
||||
int? remainingTime,
|
||||
}) {
|
||||
return ACStatusLoaded(
|
||||
status: status ?? this.status,
|
||||
scheduledHours: scheduledHours ?? this.scheduledHours,
|
||||
scheduledMinutes: scheduledMinutes ?? this.scheduledMinutes,
|
||||
isTimerActive: isTimerActive ?? this.isTimerActive,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get props => [status, timestamp];
|
||||
@ -40,3 +63,14 @@ class AcsFailedState extends AcsState {
|
||||
@override
|
||||
List<Object> get props => [error];
|
||||
}
|
||||
|
||||
class TimerRunInProgress extends AcsState {
|
||||
final int remainingTime;
|
||||
|
||||
const TimerRunInProgress(this.remainingTime);
|
||||
|
||||
@override
|
||||
List<Object> get props => [remainingTime];
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user