mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 11:14:55 +00:00
fix bugs
This commit is contained in:
@ -2,8 +2,14 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/smart_scene_enable.dart';
|
import 'package:syncrow_app/features/scene/model/smart_scene_enable.dart';
|
||||||
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
|
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||||
part 'smart_scene_select_dart_event.dart';
|
part 'smart_scene_select_dart_event.dart';
|
||||||
part 'smart_scene_select_dart_state.dart';
|
part 'smart_scene_select_dart_state.dart';
|
||||||
|
|
||||||
@ -19,7 +25,29 @@ class SmartSceneSelectBloc
|
|||||||
FutureOr<void> _onSmartSceneEnable(
|
FutureOr<void> _onSmartSceneEnable(
|
||||||
SmartSceneEnableEvent event, Emitter<SmartSceneSelectState> emit) {
|
SmartSceneEnableEvent event, Emitter<SmartSceneSelectState> emit) {
|
||||||
smartSceneEnable = event.smartSceneEnable;
|
smartSceneEnable = event.smartSceneEnable;
|
||||||
|
NavigationService.navigatorKey.currentState!.context
|
||||||
|
.read<CreateSceneBloc>()
|
||||||
|
.add(TempHoldSceneTasksEvent(
|
||||||
|
deviceControlModel: DeviceControlModel(
|
||||||
|
deviceId: smartSceneEnable?.entityId ?? '',
|
||||||
|
code: CreateSceneEnum.smartSceneSelect.name,
|
||||||
|
value: '',
|
||||||
|
),
|
||||||
|
deviceId: smartSceneEnable?.sceneORAutomationName ?? '',
|
||||||
|
operation: smartSceneEnable?.actionExecutor ?? '',
|
||||||
|
icon: smartSceneEnable?.isAutomation == true
|
||||||
|
? Assets.player
|
||||||
|
: Assets.handClickIcon,
|
||||||
|
deviceName: smartSceneEnable?.sceneORAutomationName ?? '',
|
||||||
|
uniqueId: '',
|
||||||
|
operationType: OperationDialogType.none,
|
||||||
|
isAutomation: false,
|
||||||
|
));
|
||||||
|
|
||||||
emit(SmartSceneSelected(smartSceneEnable: smartSceneEnable!));
|
emit(SmartSceneSelected(smartSceneEnable: smartSceneEnable!));
|
||||||
|
NavigationService.navigatorKey.currentState!.context
|
||||||
|
.read<CreateSceneBloc>()
|
||||||
|
.add(const AddTaskEvent(isAutomation: false));
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> _smartSceneClear(
|
FutureOr<void> _smartSceneClear(
|
||||||
@ -27,4 +55,4 @@ class SmartSceneSelectBloc
|
|||||||
smartSceneEnable = null;
|
smartSceneEnable = null;
|
||||||
emit(SmartSceneSelectInitial());
|
emit(SmartSceneSelectInitial());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
enum CreateSceneEnum {
|
enum CreateSceneEnum {
|
||||||
tabToRun,
|
tabToRun,
|
||||||
deviceStatusChanges,
|
deviceStatusChanges,
|
||||||
|
smartSceneSelect,
|
||||||
none,
|
none,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||||
import 'package:syncrow_app/features/scene/bloc/smart_scene/smart_scene_select_dart_bloc.dart';
|
import 'package:syncrow_app/features/scene/bloc/smart_scene/smart_scene_select_dart_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||||
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/create_automation_model.dart';
|
import 'package:syncrow_app/features/scene/model/create_automation_model.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/create_scene_model.dart';
|
import 'package:syncrow_app/features/scene/model/create_scene_model.dart';
|
||||||
@ -32,142 +33,129 @@ mixin SceneLogicHelper {
|
|||||||
final sceneBloc = context.read<CreateSceneBloc>();
|
final sceneBloc = context.read<CreateSceneBloc>();
|
||||||
final smartSceneBloc = context.read<SmartSceneSelectBloc>();
|
final smartSceneBloc = context.read<SmartSceneSelectBloc>();
|
||||||
|
|
||||||
|
if (isOnlyDelayOrDelayLast(actions)) {
|
||||||
|
context.showCustomSnackbar(
|
||||||
|
message: 'A single delay or delay-last operations are NOT allowed.',
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isAutomation) {
|
if (isAutomation) {
|
||||||
// Handle Automation Creation
|
final createAutomationModel = CreateAutomationModel(
|
||||||
if (isOnlyDelayOrDelayLast(actions)) {
|
unitUuid: HomeCubit.getInstance().selectedSpace!.id ?? '',
|
||||||
Navigator.pop(context);
|
automationName: sceneName.text,
|
||||||
context.showCustomSnackbar(
|
decisionExpr: sceneBloc.conditionRule,
|
||||||
message: 'A single delay or delay-last operations are NOT allowed.',
|
effectiveTime: sceneBloc.effectiveTime ??
|
||||||
icon: const Icon(
|
EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'),
|
||||||
Icons.error,
|
conditions: List.generate(
|
||||||
color: Colors.red,
|
conditions.length,
|
||||||
),
|
(index) {
|
||||||
);
|
final task = conditions[index];
|
||||||
} else {
|
return CreateCondition(
|
||||||
final createAutomationModel = CreateAutomationModel(
|
code: index + 1,
|
||||||
unitUuid: HomeCubit.getInstance().selectedSpace!.id ?? '',
|
entityId: task.deviceId,
|
||||||
automationName: sceneName.text,
|
entityType: 'device_report',
|
||||||
decisionExpr: sceneBloc.conditionRule,
|
expr: ConditionExpr(
|
||||||
effectiveTime: sceneBloc.effectiveTime ??
|
statusCode: task.code,
|
||||||
EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'),
|
comparator: task.comparator ?? '==',
|
||||||
conditions: List.generate(
|
statusValue: task.functionValue,
|
||||||
conditions.length,
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
...List.generate(
|
||||||
|
actions.length,
|
||||||
(index) {
|
(index) {
|
||||||
final task = conditions[index];
|
final task = actions[index];
|
||||||
return CreateCondition(
|
if (task.deviceId == 'delay') {
|
||||||
code: index + 1,
|
return CreateSceneAction(
|
||||||
|
entityId: actions[index].deviceId,
|
||||||
|
actionExecutor: 'delay',
|
||||||
|
executorProperty: CreateSceneExecutorProperty(
|
||||||
|
functionCode: '',
|
||||||
|
functionValue: '',
|
||||||
|
delaySeconds: task.functionValue,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (task.code == CreateSceneEnum.smartSceneSelect.name) {
|
||||||
|
return CreateSceneAction(
|
||||||
|
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
|
||||||
|
actionExecutor:
|
||||||
|
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
|
||||||
|
executorProperty: null);
|
||||||
|
}
|
||||||
|
return CreateSceneAction(
|
||||||
entityId: task.deviceId,
|
entityId: task.deviceId,
|
||||||
entityType: 'device_report',
|
actionExecutor: 'device_issue',
|
||||||
expr: ConditionExpr(
|
executorProperty: CreateSceneExecutorProperty(
|
||||||
statusCode: task.code,
|
functionCode: task.code,
|
||||||
comparator: task.comparator ?? '==',
|
functionValue: task.functionValue,
|
||||||
statusValue: task.functionValue,
|
delaySeconds: 0,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
],
|
||||||
...List.generate(
|
);
|
||||||
actions.length,
|
sceneBloc.add(CreateSceneWithTasksEvent(
|
||||||
(index) {
|
createSceneModel: null,
|
||||||
final task = actions[index];
|
updateScene: updateScene,
|
||||||
if (task.deviceId == 'delay') {
|
sceneId: sceneId,
|
||||||
return CreateSceneAction(
|
createAutomationModel: createAutomationModel,
|
||||||
entityId: actions[index].deviceId,
|
));
|
||||||
actionExecutor: 'delay',
|
|
||||||
executorProperty: CreateSceneExecutorProperty(
|
|
||||||
functionCode: '',
|
|
||||||
functionValue: '',
|
|
||||||
delaySeconds: task.functionValue,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return CreateSceneAction(
|
|
||||||
entityId: task.deviceId,
|
|
||||||
actionExecutor: 'device_issue',
|
|
||||||
executorProperty: CreateSceneExecutorProperty(
|
|
||||||
functionCode: task.code,
|
|
||||||
functionValue: task.functionValue,
|
|
||||||
delaySeconds: 0,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (smartSceneBloc.smartSceneEnable != null)
|
|
||||||
CreateSceneAction(
|
|
||||||
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
|
|
||||||
actionExecutor:
|
|
||||||
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
|
|
||||||
executorProperty: null)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
sceneBloc.add(CreateSceneWithTasksEvent(
|
|
||||||
createSceneModel: null,
|
|
||||||
updateScene: updateScene,
|
|
||||||
sceneId: sceneId,
|
|
||||||
createAutomationModel: createAutomationModel,
|
|
||||||
));
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (isOnlyDelayOrDelayLast(actions)) {
|
final createSceneModel = CreateSceneModel(
|
||||||
Navigator.pop(context);
|
unitUuid: HomeCubit.getInstance().selectedSpace!.id ?? '',
|
||||||
context.showCustomSnackbar(
|
sceneName: sceneName.text,
|
||||||
message: 'A single delay or delay-last operations are NOT allowed.',
|
decisionExpr: 'and',
|
||||||
icon: const Icon(
|
actions: [
|
||||||
Icons.error,
|
...List.generate(
|
||||||
color: Colors.red,
|
actions.length,
|
||||||
),
|
(index) {
|
||||||
);
|
final task = actions[index];
|
||||||
} else {
|
if (task.deviceId == 'delay') {
|
||||||
// Handle Scene Creation
|
|
||||||
final createSceneModel = CreateSceneModel(
|
|
||||||
unitUuid: HomeCubit.getInstance().selectedSpace!.id ?? '',
|
|
||||||
sceneName: sceneName.text,
|
|
||||||
decisionExpr: 'and',
|
|
||||||
actions: [
|
|
||||||
...List.generate(
|
|
||||||
actions.length,
|
|
||||||
(index) {
|
|
||||||
final task = actions[index];
|
|
||||||
if (task.deviceId == 'delay') {
|
|
||||||
return CreateSceneAction(
|
|
||||||
entityId: actions[index].deviceId,
|
|
||||||
actionExecutor: 'delay',
|
|
||||||
executorProperty: CreateSceneExecutorProperty(
|
|
||||||
functionCode: '',
|
|
||||||
functionValue: '',
|
|
||||||
delaySeconds: task.functionValue,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return CreateSceneAction(
|
return CreateSceneAction(
|
||||||
entityId: task.deviceId,
|
entityId: actions[index].deviceId,
|
||||||
actionExecutor: 'device_issue',
|
actionExecutor: 'delay',
|
||||||
executorProperty: CreateSceneExecutorProperty(
|
executorProperty: CreateSceneExecutorProperty(
|
||||||
functionCode: task.code,
|
functionCode: '',
|
||||||
functionValue: task.functionValue,
|
functionValue: '',
|
||||||
delaySeconds: 0,
|
delaySeconds: task.functionValue,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
),
|
if (task.code == CreateSceneEnum.smartSceneSelect.name) {
|
||||||
if (smartSceneBloc.smartSceneEnable != null)
|
return CreateSceneAction(
|
||||||
CreateSceneAction(
|
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
|
||||||
entityId: smartSceneBloc.smartSceneEnable?.entityId ?? '',
|
actionExecutor:
|
||||||
actionExecutor:
|
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
|
||||||
smartSceneBloc.smartSceneEnable?.actionExecutor ?? '',
|
executorProperty: null);
|
||||||
executorProperty: null)
|
}
|
||||||
],
|
return CreateSceneAction(
|
||||||
);
|
entityId: task.deviceId,
|
||||||
sceneBloc.add(CreateSceneWithTasksEvent(
|
actionExecutor: 'device_issue',
|
||||||
createSceneModel: createSceneModel,
|
executorProperty: CreateSceneExecutorProperty(
|
||||||
createAutomationModel: null,
|
functionCode: task.code,
|
||||||
updateScene: updateScene,
|
functionValue: task.functionValue,
|
||||||
sceneId: sceneId,
|
delaySeconds: 0,
|
||||||
));
|
),
|
||||||
Navigator.pop(context);
|
);
|
||||||
}
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
sceneBloc.add(CreateSceneWithTasksEvent(
|
||||||
|
createSceneModel: createSceneModel,
|
||||||
|
createAutomationModel: null,
|
||||||
|
updateScene: updateScene,
|
||||||
|
sceneId: sceneId,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,12 +102,18 @@ class CreateSceneAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
if (executorProperty != null) {
|
||||||
'entityId': entityId,
|
return {
|
||||||
'actionExecutor': actionExecutor,
|
'entityId': entityId,
|
||||||
if (executorProperty != null)
|
'actionExecutor': actionExecutor,
|
||||||
'executorProperty': executorProperty?.toMap(actionExecutor),
|
'executorProperty': executorProperty?.toMap(actionExecutor),
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'entityId': entityId,
|
||||||
|
'actionExecutor': actionExecutor,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
factory CreateSceneAction.fromMap(Map<String, dynamic> map) {
|
factory CreateSceneAction.fromMap(Map<String, dynamic> map) {
|
||||||
|
|||||||
@ -1,16 +1,22 @@
|
|||||||
class SmartSceneEnable {
|
class SmartSceneEnable {
|
||||||
final String entityId;
|
final String entityId;
|
||||||
final String actionExecutor;
|
final String actionExecutor;
|
||||||
|
final String sceneORAutomationName;
|
||||||
|
final bool isAutomation;
|
||||||
|
|
||||||
SmartSceneEnable({
|
SmartSceneEnable({
|
||||||
required this.entityId,
|
required this.entityId,
|
||||||
required this.actionExecutor,
|
required this.actionExecutor,
|
||||||
|
required this.sceneORAutomationName,
|
||||||
|
required this.isAutomation,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory SmartSceneEnable.fromJson(Map<String, dynamic> json) {
|
factory SmartSceneEnable.fromJson(Map<String, dynamic> json) {
|
||||||
return SmartSceneEnable(
|
return SmartSceneEnable(
|
||||||
entityId: json['entityId'],
|
entityId: json['entityId'],
|
||||||
actionExecutor: json['actionExecutor'],
|
actionExecutor: json['actionExecutor'],
|
||||||
|
sceneORAutomationName: json['sceneORAutomationName'],
|
||||||
|
isAutomation: json['isAutomation'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,6 +24,8 @@ class SmartSceneEnable {
|
|||||||
return {
|
return {
|
||||||
'entityId': entityId,
|
'entityId': entityId,
|
||||||
'actionExecutor': actionExecutor,
|
'actionExecutor': actionExecutor,
|
||||||
|
'sceneORAutomationName': sceneORAutomationName,
|
||||||
|
'isAutomation': isAutomation,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,13 @@ class SceneTasksView extends StatelessWidget {
|
|||||||
? sceneSettings.sceneName
|
? sceneSettings.sceneName
|
||||||
: StringsManager.createScene,
|
: StringsManager.createScene,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
|
leading: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
navigateToRoute(context, Routes.homeRoute);
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.arrow_back_ios,
|
||||||
|
)),
|
||||||
actions: [
|
actions: [
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: sceneSettings.sceneType.isNotEmpty,
|
visible: sceneSettings.sceneType.isNotEmpty,
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/select_smart_scene/smart_enable_autoamtion.dart';
|
import 'package:syncrow_app/features/scene/widgets/select_smart_scene/smart_enable_autoamtion.dart';
|
||||||
import 'package:syncrow_app/features/scene/widgets/select_smart_scene/smart_enable_tab_run.dart';
|
import 'package:syncrow_app/features/scene/widgets/select_smart_scene/smart_enable_tab_run.dart';
|
||||||
@ -15,6 +18,7 @@ class SmartAutomationSelectView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final sceneType = context.read<CreateSceneBloc>().sceneType;
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: "Select Smart Scene",
|
title: "Select Smart Scene",
|
||||||
padding: const EdgeInsets.only(top: 24),
|
padding: const EdgeInsets.only(top: 24),
|
||||||
@ -25,28 +29,38 @@ class SmartAutomationSelectView extends StatelessWidget {
|
|||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.arrow_back_ios,
|
Icons.arrow_back_ios,
|
||||||
)),
|
)),
|
||||||
height: 260,
|
height: sceneType.name == CreateSceneEnum.deviceStatusChanges.name
|
||||||
|
? 260
|
||||||
|
: 200,
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SceneListTile(
|
Visibility(
|
||||||
assetPath: Assets.handClickIcon,
|
visible:
|
||||||
titleString: "Tap To Run",
|
sceneType.name == CreateSceneEnum.deviceStatusChanges.name,
|
||||||
subtitleString: '',
|
child: SceneListTile(
|
||||||
trailingWidget: const Icon(
|
assetPath: Assets.handClickIcon,
|
||||||
Icons.arrow_forward_ios_rounded,
|
titleString: "Tap To Run",
|
||||||
color: ColorsManager.greyColor,
|
subtitleString: '',
|
||||||
|
trailingWidget: const Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
color: ColorsManager.greyColor,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
context.customBottomSheet(
|
||||||
|
child: const SmartEnableTabRun(),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onPressed: () {
|
|
||||||
context.customBottomSheet(
|
|
||||||
child: const SmartEnableTabRun(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
const Divider(
|
Visibility(
|
||||||
color: ColorsManager.dividerColor,
|
visible:
|
||||||
|
sceneType.name == CreateSceneEnum.deviceStatusChanges.name,
|
||||||
|
child: const Divider(
|
||||||
|
color: ColorsManager.dividerColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SceneListTile(
|
SceneListTile(
|
||||||
assetPath: Assets.refreshIcon,
|
assetPath: Assets.refreshIcon,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart
|
|||||||
import 'package:syncrow_app/navigation/navigate_to_route.dart';
|
import 'package:syncrow_app/navigation/navigate_to_route.dart';
|
||||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||||
import 'package:syncrow_app/utils/context_extension.dart';
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
class CreateSceneSaveButton extends StatefulWidget {
|
class CreateSceneSaveButton extends StatefulWidget {
|
||||||
@ -57,13 +58,7 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
|||||||
sceneNameController.text = '';
|
sceneNameController.text = '';
|
||||||
}
|
}
|
||||||
} else if (state is CreateSceneError) {
|
} else if (state is CreateSceneError) {
|
||||||
context.showCustomSnackbar(
|
CustomSnackBar.displaySnackBar(state.message);
|
||||||
message: state.message,
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.error,
|
|
||||||
color: Colors.red,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
@ -106,6 +101,7 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
|
|||||||
),
|
),
|
||||||
title: 'Scene Name',
|
title: 'Scene Name',
|
||||||
onConfirm: () {
|
onConfirm: () {
|
||||||
|
Navigator.pop(context);
|
||||||
if (sceneNameController.text.isNotEmpty) {
|
if (sceneNameController.text.isNotEmpty) {
|
||||||
handleSaveButtonPress(
|
handleSaveButtonPress(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@ -27,94 +27,164 @@ class IFDefaultContainer extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final sceneType = context.read<CreateSceneBloc>().sceneType;
|
return BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||||
return DefaultContainer(
|
builder: (context, state) {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
|
final sceneType = context.read<CreateSceneBloc>().sceneType;
|
||||||
child: Column(
|
return DefaultContainer(
|
||||||
mainAxisSize: MainAxisSize.min,
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
|
||||||
children: [
|
child: Column(
|
||||||
SceneListTile(
|
mainAxisSize: MainAxisSize.min,
|
||||||
leadingWidget: InkWell(
|
children: [
|
||||||
onTap: () {
|
SceneListTile(
|
||||||
if (sceneType.name ==
|
leadingWidget: InkWell(
|
||||||
CreateSceneEnum.deviceStatusChanges.name) {
|
onTap: () {
|
||||||
context.customAlertDialog(
|
if (sceneType.name ==
|
||||||
hideConfirmButton: true,
|
CreateSceneEnum.deviceStatusChanges.name) {
|
||||||
alertBody: Column(
|
context.customAlertDialog(
|
||||||
children: [
|
hideConfirmButton: true,
|
||||||
ListTile(
|
alertBody: Column(
|
||||||
title: const BodyMedium(
|
children: [
|
||||||
text: "When all conditions are met"),
|
ListTile(
|
||||||
onTap: () {
|
title: const BodyMedium(
|
||||||
context.read<CreateSceneBloc>().add(
|
text: "When all conditions are met"),
|
||||||
const SelectConditionEvent(
|
onTap: () {
|
||||||
"When all conditions are met"));
|
context.read<CreateSceneBloc>().add(
|
||||||
Navigator.pop(context);
|
const SelectConditionEvent(
|
||||||
|
"When all conditions are met"));
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const BodyMedium(
|
||||||
|
text: "When any condition is met"),
|
||||||
|
onTap: () {
|
||||||
|
context.read<CreateSceneBloc>().add(
|
||||||
|
const SelectConditionEvent(
|
||||||
|
"When any condition is met"));
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
title: 'Conditions Rule',
|
||||||
|
onConfirm: () {},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
BodyLarge(
|
||||||
|
text: 'IF',
|
||||||
|
style: context.bodyLarge.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: ColorsManager.primaryTextColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: sceneType.name ==
|
||||||
|
CreateSceneEnum.deviceStatusChanges.name,
|
||||||
|
child: BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
String conditionText = "When any condition is met";
|
||||||
|
if (state is AddSceneTask) {
|
||||||
|
if (state.condition == 'or') {
|
||||||
|
conditionText = "When any condition is met";
|
||||||
|
} else {
|
||||||
|
conditionText = "When all conditions are met";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SizedBox(
|
||||||
|
width: context.width * 0.6,
|
||||||
|
child: Row(children: [
|
||||||
|
BodySmall(text: conditionText),
|
||||||
|
const Icon(Icons.keyboard_arrow_down)
|
||||||
|
]),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
),
|
||||||
title: const BodyMedium(
|
],
|
||||||
text: "When any condition is met"),
|
),
|
||||||
onTap: () {
|
),
|
||||||
context.read<CreateSceneBloc>().add(
|
trailingWidget: BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||||
const SelectConditionEvent(
|
builder: (context, state) {
|
||||||
"When any condition is met"));
|
bool isClickable = false;
|
||||||
Navigator.pop(context);
|
if (state is AddSceneTask) {
|
||||||
},
|
isClickable =
|
||||||
|
state.automationTasksList?.isNotEmpty ?? false;
|
||||||
|
}
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: isClickable
|
||||||
|
? () => Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routes.sceneControlDevicesRoute,
|
||||||
|
arguments: SceneSettingsRouteArguments(
|
||||||
|
sceneType:
|
||||||
|
CreateSceneEnum.deviceStatusChanges.name,
|
||||||
|
sceneId: '',
|
||||||
|
sceneName: '',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.addIcon,
|
||||||
|
colorFilter: ColorFilter.mode(
|
||||||
|
isClickable
|
||||||
|
? ColorsManager.primaryColor
|
||||||
|
: ColorsManager.greyColor,
|
||||||
|
BlendMode.srcIn,
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
title: 'Conditions Rule',
|
},
|
||||||
onConfirm: () {},
|
),
|
||||||
);
|
padding: EdgeInsets.zero,
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
BodyLarge(
|
|
||||||
text: 'IF',
|
|
||||||
style: context.bodyLarge.copyWith(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: ColorsManager.primaryTextColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: sceneType.name ==
|
|
||||||
CreateSceneEnum.deviceStatusChanges.name,
|
|
||||||
child: BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
String conditionText = "When any condition is met";
|
|
||||||
if (state is AddSceneTask) {
|
|
||||||
if (state.condition == 'or') {
|
|
||||||
conditionText = "When any condition is met";
|
|
||||||
} else {
|
|
||||||
conditionText = "When all conditions are met";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return SizedBox(
|
|
||||||
width: context.width * 0.6,
|
|
||||||
child: Row(children: [
|
|
||||||
BodySmall(text: conditionText),
|
|
||||||
const Icon(Icons.keyboard_arrow_down)
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const LightDivider(),
|
||||||
trailingWidget: BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
bool isClickable = false;
|
if (state is AddSceneTask) {
|
||||||
if (state is AddSceneTask) {
|
final automationTasksList = state.automationTasksList;
|
||||||
isClickable = state.automationTasksList?.isNotEmpty ?? false;
|
if (automationTasksList?.isNotEmpty == true) {
|
||||||
}
|
return ListView.builder(
|
||||||
return GestureDetector(
|
shrinkWrap: true,
|
||||||
onTap: isClickable
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
? () => Navigator.pushNamed(
|
itemCount: automationTasksList?.length,
|
||||||
|
reverse: true,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ThenAddedTasksContainer(
|
||||||
|
taskItem: automationTasksList![index],
|
||||||
|
isAutomation: true,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final sceneType = context.read<CreateSceneBloc>().sceneType;
|
||||||
|
if (sceneType.name == CreateSceneEnum.tabToRun.name) {
|
||||||
|
return const SceneListTile(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 2),
|
||||||
|
assetPath: Assets.handClickIcon,
|
||||||
|
titleString: StringsManager.tapToRun,
|
||||||
|
subtitleString: '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return SceneListTile(
|
||||||
|
titleString: '+ Add Condition',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
onPressed: () {
|
||||||
|
final sceneType =
|
||||||
|
context.read<CreateSceneBloc>().sceneType;
|
||||||
|
if (sceneType.name == CreateSceneEnum.none.name) {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
CustomPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const CreateSceneView()));
|
||||||
|
} else {
|
||||||
|
Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
Routes.sceneControlDevicesRoute,
|
Routes.sceneControlDevicesRoute,
|
||||||
arguments: SceneSettingsRouteArguments(
|
arguments: SceneSettingsRouteArguments(
|
||||||
@ -123,77 +193,15 @@ class IFDefaultContainer extends StatelessWidget {
|
|||||||
sceneId: '',
|
sceneId: '',
|
||||||
sceneName: '',
|
sceneName: '',
|
||||||
),
|
),
|
||||||
)
|
);
|
||||||
: null,
|
}
|
||||||
child: SvgPicture.asset(
|
});
|
||||||
Assets.addIcon,
|
},
|
||||||
colorFilter: ColorFilter.mode(
|
)
|
||||||
isClickable
|
],
|
||||||
? ColorsManager.primaryColor
|
|
||||||
: ColorsManager.greyColor,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
),
|
),
|
||||||
const LightDivider(),
|
);
|
||||||
BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
},
|
||||||
builder: (context, state) {
|
|
||||||
if (state is AddSceneTask) {
|
|
||||||
final automationTasksList = state.automationTasksList;
|
|
||||||
if (automationTasksList?.isNotEmpty == true) {
|
|
||||||
return ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
itemCount: automationTasksList?.length,
|
|
||||||
reverse: true,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return ThenAddedTasksContainer(
|
|
||||||
taskItem: automationTasksList![index],
|
|
||||||
isAutomation: true,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final sceneType = context.read<CreateSceneBloc>().sceneType;
|
|
||||||
if (sceneType.name == CreateSceneEnum.tabToRun.name) {
|
|
||||||
return const SceneListTile(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 2),
|
|
||||||
assetPath: Assets.handClickIcon,
|
|
||||||
titleString: StringsManager.tapToRun,
|
|
||||||
subtitleString: '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return SceneListTile(
|
|
||||||
titleString: '+ Add Condition',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
onPressed: () {
|
|
||||||
final sceneType = context.read<CreateSceneBloc>().sceneType;
|
|
||||||
if (sceneType.name == CreateSceneEnum.none.name) {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
CustomPageRoute(
|
|
||||||
builder: (context) => const CreateSceneView()));
|
|
||||||
} else {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context,
|
|
||||||
Routes.sceneControlDevicesRoute,
|
|
||||||
arguments: SceneSettingsRouteArguments(
|
|
||||||
sceneType: CreateSceneEnum.deviceStatusChanges.name,
|
|
||||||
sceneId: '',
|
|
||||||
sceneName: '',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||||
import 'package:syncrow_app/features/scene/helper/scene_logic_helper.dart';
|
import 'package:syncrow_app/features/scene/helper/scene_logic_helper.dart';
|
||||||
import 'package:syncrow_app/features/scene/helper/scene_operations_data_helper.dart';
|
import 'package:syncrow_app/features/scene/helper/scene_operations_data_helper.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||||
@ -62,58 +63,63 @@ class ThenAddedTasksContainer extends StatelessWidget
|
|||||||
operationValue = functionValue.toString();
|
operationValue = functionValue.toString();
|
||||||
}
|
}
|
||||||
return DefaultContainer(
|
return DefaultContainer(
|
||||||
onTap: () {
|
onTap: taskItem.code == CreateSceneEnum.smartSceneSelect.name
|
||||||
List<SceneStaticFunction> functionOperation = [];
|
? null
|
||||||
|
: () {
|
||||||
|
List<SceneStaticFunction> functionOperation = [];
|
||||||
|
|
||||||
/// get the task functions
|
/// get the task functions
|
||||||
functionOperation = List.from(getOperationsForOneFunction(
|
functionOperation = List.from(getOperationsForOneFunction(
|
||||||
taskItem: taskItem,
|
taskItem: taskItem,
|
||||||
deviceId: taskItem.deviceId,
|
deviceId: taskItem.deviceId,
|
||||||
isAutomation: isAutomation ?? false));
|
isAutomation: isAutomation ?? false));
|
||||||
|
|
||||||
/// show alert dialog based on type
|
/// show alert dialog based on type
|
||||||
context.customAlertDialog(
|
context.customAlertDialog(
|
||||||
alertBody: getTheCorrectDialogBody(functionOperation.first, null,
|
alertBody: getTheCorrectDialogBody(
|
||||||
isAutomation: isAutomation ?? false),
|
functionOperation.first, null,
|
||||||
title: functionOperation.first.operationName,
|
isAutomation: isAutomation ?? false),
|
||||||
onConfirm: () {
|
title: functionOperation.first.operationName,
|
||||||
final savedCode = functionOperation.first.deviceId.contains('delay')
|
onConfirm: () {
|
||||||
? 'delay'
|
final savedCode =
|
||||||
: functionOperation.first.code;
|
functionOperation.first.deviceId.contains('delay')
|
||||||
if (isAutomation == true) {
|
? 'delay'
|
||||||
final automationSelectedValue =
|
: functionOperation.first.code;
|
||||||
createSceneBloc.automationSelectedValues[savedCode];
|
if (isAutomation == true) {
|
||||||
|
final automationSelectedValue =
|
||||||
|
createSceneBloc.automationSelectedValues[savedCode];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
createSceneBloc.add(
|
createSceneBloc.add(
|
||||||
UpdateTaskEvent(
|
UpdateTaskEvent(
|
||||||
newValue: automationSelectedValue,
|
newValue: automationSelectedValue,
|
||||||
taskId: taskItem.uniqueCustomId,
|
taskId: taskItem.uniqueCustomId,
|
||||||
isAutomation: true,
|
isAutomation: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Error adding UpdateTaskEvent: $e');
|
debugPrint('Error adding UpdateTaskEvent: $e');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final selectedValue = createSceneBloc.selectedValues[savedCode];
|
final selectedValue =
|
||||||
|
createSceneBloc.selectedValues[savedCode];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
createSceneBloc.add(
|
createSceneBloc.add(
|
||||||
UpdateTaskEvent(
|
UpdateTaskEvent(
|
||||||
newValue: selectedValue,
|
newValue: selectedValue,
|
||||||
taskId: taskItem.uniqueCustomId,
|
taskId: taskItem.uniqueCustomId,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Error adding UpdateTaskEvent: $e');
|
debugPrint('Error adding UpdateTaskEvent: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
child: Dismissible(
|
child: Dismissible(
|
||||||
key: Key(taskItem.uniqueCustomId.toString()),
|
key: Key(taskItem.uniqueCustomId.toString()),
|
||||||
@ -171,12 +177,20 @@ class ThenAddedTasksContainer extends StatelessWidget
|
|||||||
subtitleWidget: Row(
|
subtitleWidget: Row(
|
||||||
children: [
|
children: [
|
||||||
BodyMedium(
|
BodyMedium(
|
||||||
text: "${taskItem.operationName}: ",
|
text: taskItem.code == CreateSceneEnum.smartSceneSelect.name
|
||||||
|
? taskItem.icon.contains('player')
|
||||||
|
? 'Automation: '
|
||||||
|
: "Tab-To-Run: "
|
||||||
|
: "${taskItem.operationName}: ",
|
||||||
fontColor: ColorsManager.secondaryTextColor,
|
fontColor: ColorsManager.secondaryTextColor,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
BodyMedium(
|
BodyMedium(
|
||||||
text: operationValue,
|
text: taskItem.code == CreateSceneEnum.smartSceneSelect.name
|
||||||
|
? taskItem.operationName == 'rule_enable'
|
||||||
|
? 'Enable'
|
||||||
|
: "Disable"
|
||||||
|
: operationValue,
|
||||||
fontColor: ColorsManager.secondaryTextColor,
|
fontColor: ColorsManager.secondaryTextColor,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -125,6 +125,7 @@ class _SmartSceneSelectAutomationListState
|
|||||||
alertBody: EnableDisableAutomationDialog(
|
alertBody: EnableDisableAutomationDialog(
|
||||||
automationId: automation.id,
|
automationId: automation.id,
|
||||||
descriptionSelected: descriptionSelected,
|
descriptionSelected: descriptionSelected,
|
||||||
|
sceneORAutomationName: automation.name,
|
||||||
),
|
),
|
||||||
title: automation.name,
|
title: automation.name,
|
||||||
onConfirm: () {
|
onConfirm: () {
|
||||||
@ -157,6 +158,7 @@ class _SmartSceneSelectAutomationListState
|
|||||||
alertBody: EnableDisableAutomationDialog(
|
alertBody: EnableDisableAutomationDialog(
|
||||||
automationId: automation.id,
|
automationId: automation.id,
|
||||||
descriptionSelected: descriptionSelected,
|
descriptionSelected: descriptionSelected,
|
||||||
|
sceneORAutomationName: automation.name,
|
||||||
),
|
),
|
||||||
title: automation.name,
|
title: automation.name,
|
||||||
onConfirm: () {
|
onConfirm: () {
|
||||||
@ -191,10 +193,12 @@ class EnableDisableAutomationDialog extends StatefulWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.automationId,
|
required this.automationId,
|
||||||
required this.descriptionSelected,
|
required this.descriptionSelected,
|
||||||
|
required this.sceneORAutomationName,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String automationId;
|
final String automationId;
|
||||||
final String descriptionSelected;
|
final String descriptionSelected;
|
||||||
|
final String sceneORAutomationName;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EnableDisableAutomationDialog> createState() =>
|
State<EnableDisableAutomationDialog> createState() =>
|
||||||
@ -251,9 +255,11 @@ class _EnableDisableAutomationDialogState
|
|||||||
.read<SmartSceneSelectBloc>()
|
.read<SmartSceneSelectBloc>()
|
||||||
.add(SmartSceneEnableEvent(
|
.add(SmartSceneEnableEvent(
|
||||||
SmartSceneEnable(
|
SmartSceneEnable(
|
||||||
entityId: widget.automationId,
|
entityId: widget.automationId,
|
||||||
actionExecutor: value!,
|
actionExecutor: value!,
|
||||||
),
|
sceneORAutomationName:
|
||||||
|
widget.sceneORAutomationName,
|
||||||
|
isAutomation: true),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -267,6 +273,8 @@ class _EnableDisableAutomationDialogState
|
|||||||
SmartSceneEnable(
|
SmartSceneEnable(
|
||||||
entityId: widget.automationId,
|
entityId: widget.automationId,
|
||||||
actionExecutor: operation.value,
|
actionExecutor: operation.value,
|
||||||
|
sceneORAutomationName: widget.sceneORAutomationName,
|
||||||
|
isAutomation: true,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
|
|||||||
@ -89,6 +89,8 @@ class _SmartSceneSelectTabToRunListState
|
|||||||
.add(SmartSceneEnableEvent(SmartSceneEnable(
|
.add(SmartSceneEnableEvent(SmartSceneEnable(
|
||||||
entityId: scene.id,
|
entityId: scene.id,
|
||||||
actionExecutor: 'rule_enable',
|
actionExecutor: 'rule_enable',
|
||||||
|
sceneORAutomationName: scene.name,
|
||||||
|
isAutomation: false,
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -101,6 +103,8 @@ class _SmartSceneSelectTabToRunListState
|
|||||||
.add(SmartSceneEnableEvent(SmartSceneEnable(
|
.add(SmartSceneEnableEvent(SmartSceneEnable(
|
||||||
entityId: scene.id,
|
entityId: scene.id,
|
||||||
actionExecutor: 'rule_enable',
|
actionExecutor: 'rule_enable',
|
||||||
|
sceneORAutomationName: scene.name,
|
||||||
|
isAutomation: false,
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user