mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
137 lines
4.4 KiB
Dart
137 lines
4.4 KiB
Dart
part of 'routine_bloc.dart';
|
|
|
|
class RoutineState extends Equatable {
|
|
final List<Map<String, dynamic>> ifItems;
|
|
final List<Map<String, dynamic>> thenItems;
|
|
final List<Map<String, String>> availableCards;
|
|
final List<ScenesModel> scenes;
|
|
final List<ScenesModel> automations;
|
|
final Map<String, List<DeviceFunctionData>> selectedFunctions;
|
|
final bool isLoading;
|
|
final String? errorMessage;
|
|
final String? loadScenesErrorMessage;
|
|
final String? loadAutomationErrorMessage;
|
|
final String? routineName;
|
|
final String? selectedIcon;
|
|
final String? searchText;
|
|
final bool isTabToRun;
|
|
final bool isAutomation;
|
|
final String selectedAutomationOperator;
|
|
final EffectiveTime? effectiveTime;
|
|
final String? sceneId;
|
|
final String? automationId;
|
|
final bool? isUpdate;
|
|
final List<AllDevicesModel> devices;
|
|
// final String? automationActionExecutor;
|
|
final bool routineTab;
|
|
final bool createRoutineView;
|
|
|
|
const RoutineState(
|
|
{this.ifItems = const [],
|
|
this.thenItems = const [],
|
|
this.availableCards = const [],
|
|
this.scenes = const [],
|
|
this.automations = const [],
|
|
this.selectedFunctions = const {},
|
|
this.isLoading = false,
|
|
this.errorMessage,
|
|
this.routineName,
|
|
this.selectedIcon,
|
|
this.loadScenesErrorMessage,
|
|
this.loadAutomationErrorMessage,
|
|
this.searchText,
|
|
this.isTabToRun = false,
|
|
this.isAutomation = false,
|
|
this.selectedAutomationOperator = 'or',
|
|
this.effectiveTime,
|
|
this.sceneId,
|
|
this.automationId,
|
|
this.isUpdate,
|
|
this.devices = const [],
|
|
// this.automationActionExecutor,
|
|
this.routineTab = false,
|
|
this.createRoutineView = false});
|
|
|
|
RoutineState copyWith({
|
|
List<Map<String, dynamic>>? ifItems,
|
|
List<Map<String, dynamic>>? thenItems,
|
|
List<ScenesModel>? scenes,
|
|
List<ScenesModel>? automations,
|
|
Map<String, List<DeviceFunctionData>>? selectedFunctions,
|
|
bool? isLoading,
|
|
String? errorMessage,
|
|
String? routineName,
|
|
String? selectedIcon,
|
|
String? loadAutomationErrorMessage,
|
|
String? loadScenesErrorMessage,
|
|
String? searchText,
|
|
bool? isTabToRun,
|
|
bool? isAutomation,
|
|
String? selectedAutomationOperator,
|
|
EffectiveTime? effectiveTime,
|
|
String? sceneId,
|
|
String? automationId,
|
|
bool? isUpdate,
|
|
List<AllDevicesModel>? devices,
|
|
// String? automationActionExecutor,
|
|
TextEditingController? nameController,
|
|
bool? routineTab,
|
|
bool? createRoutineView,
|
|
}) {
|
|
return RoutineState(
|
|
ifItems: ifItems ?? this.ifItems,
|
|
thenItems: thenItems ?? this.thenItems,
|
|
scenes: scenes ?? this.scenes,
|
|
automations: automations ?? this.automations,
|
|
selectedFunctions: selectedFunctions ?? this.selectedFunctions,
|
|
isLoading: isLoading ?? this.isLoading,
|
|
errorMessage: errorMessage ?? this.errorMessage,
|
|
routineName: routineName ?? this.routineName,
|
|
selectedIcon: selectedIcon ?? this.selectedIcon,
|
|
loadScenesErrorMessage:
|
|
loadScenesErrorMessage ?? this.loadScenesErrorMessage,
|
|
loadAutomationErrorMessage:
|
|
loadAutomationErrorMessage ?? this.loadAutomationErrorMessage,
|
|
searchText: searchText ?? this.searchText,
|
|
isTabToRun: isTabToRun ?? this.isTabToRun,
|
|
isAutomation: isAutomation ?? this.isAutomation,
|
|
selectedAutomationOperator:
|
|
selectedAutomationOperator ?? this.selectedAutomationOperator,
|
|
effectiveTime: effectiveTime ?? this.effectiveTime,
|
|
sceneId: sceneId ?? this.sceneId,
|
|
automationId: automationId ?? this.automationId,
|
|
isUpdate: isUpdate ?? this.isUpdate,
|
|
devices: devices ?? this.devices,
|
|
// automationActionExecutor: automationActionExecutor ?? this.automationActionExecutor,
|
|
routineTab: routineTab ?? this.routineTab,
|
|
createRoutineView: createRoutineView ?? this.createRoutineView);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
ifItems,
|
|
thenItems,
|
|
scenes,
|
|
automations,
|
|
selectedFunctions,
|
|
isLoading,
|
|
errorMessage,
|
|
routineName,
|
|
selectedIcon,
|
|
loadScenesErrorMessage,
|
|
loadAutomationErrorMessage,
|
|
searchText,
|
|
isTabToRun,
|
|
isAutomation,
|
|
selectedAutomationOperator,
|
|
effectiveTime,
|
|
sceneId,
|
|
automationId,
|
|
isUpdate,
|
|
devices,
|
|
// automationActionExecutor,
|
|
routineTab,
|
|
createRoutineView
|
|
];
|
|
}
|