mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
routines and automation Toggle
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
part of 'routine_bloc.dart';
|
||||
|
||||
class RoutineState extends Equatable {
|
||||
final String? loadingSceneId;
|
||||
final List<Map<String, dynamic>> ifItems;
|
||||
final List<Map<String, dynamic>> thenItems;
|
||||
final List<Map<String, String>> availableCards;
|
||||
@ -25,6 +26,7 @@ class RoutineState extends Equatable {
|
||||
// final String? automationActionExecutor;
|
||||
final bool routineTab;
|
||||
final bool createRoutineView;
|
||||
final Set<String>? loadingAutomationIds; // Track loading automations
|
||||
|
||||
const RoutineState(
|
||||
{this.ifItems = const [],
|
||||
@ -47,12 +49,16 @@ class RoutineState extends Equatable {
|
||||
this.sceneId,
|
||||
this.automationId,
|
||||
this.isUpdate,
|
||||
this.loadingAutomationIds = const <String>{}, // Initialize with empty set
|
||||
this.loadingSceneId,
|
||||
this.devices = const [],
|
||||
// this.automationActionExecutor,
|
||||
this.routineTab = false,
|
||||
this.createRoutineView = false});
|
||||
|
||||
RoutineState copyWith({
|
||||
String? loadingSceneId,
|
||||
Set<String>? loadingAutomationIds,
|
||||
List<Map<String, dynamic>>? ifItems,
|
||||
List<Map<String, dynamic>>? thenItems,
|
||||
List<ScenesModel>? scenes,
|
||||
@ -79,6 +85,8 @@ class RoutineState extends Equatable {
|
||||
bool? createRoutineView,
|
||||
}) {
|
||||
return RoutineState(
|
||||
loadingSceneId: loadingSceneId,
|
||||
loadingAutomationIds: loadingAutomationIds ?? this.loadingAutomationIds,
|
||||
ifItems: ifItems ?? this.ifItems,
|
||||
thenItems: thenItems ?? this.thenItems,
|
||||
scenes: scenes ?? this.scenes,
|
||||
@ -109,6 +117,7 @@ class RoutineState extends Equatable {
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
loadingAutomationIds,
|
||||
ifItems,
|
||||
thenItems,
|
||||
scenes,
|
||||
@ -134,3 +143,38 @@ class RoutineState extends Equatable {
|
||||
createRoutineView
|
||||
];
|
||||
}
|
||||
|
||||
class SceneInitial extends RoutineState {}
|
||||
|
||||
class SceneLoading extends RoutineState {}
|
||||
|
||||
class SceneLoaded extends RoutineState {
|
||||
final List<ScenesModel>? scenesOrAutomation;
|
||||
const SceneLoaded({this.scenesOrAutomation});
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
scenesOrAutomation,
|
||||
];
|
||||
}
|
||||
|
||||
class SceneError extends RoutineState {
|
||||
final String message;
|
||||
|
||||
const SceneError({required this.message});
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
class SceneTriggerSuccess extends RoutineState {
|
||||
final String sceneName;
|
||||
|
||||
const SceneTriggerSuccess(this.sceneName);
|
||||
|
||||
@override
|
||||
List<Object> get props => [sceneName];
|
||||
}
|
||||
|
||||
class UpdateAutomationStatusLoading extends RoutineState {
|
||||
const UpdateAutomationStatusLoading();
|
||||
}
|
||||
|
Reference in New Issue
Block a user