push fixes

This commit is contained in:
ashrafzarkanisala
2024-08-01 03:11:03 +03:00
parent a242876e16
commit b66fbc32e7
21 changed files with 647 additions and 331 deletions
@@ -126,9 +126,13 @@ class _SmartSceneSelectAutomationListState
automationId: automation.id,
descriptionSelected: descriptionSelected,
sceneORAutomationName: automation.name,
type: automation.type,
),
title: automation.name,
onConfirm: () {
context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneConfirmSelectionEvent());
Navigator.pop(context);
},
onDismiss: () {
@@ -159,9 +163,13 @@ class _SmartSceneSelectAutomationListState
automationId: automation.id,
descriptionSelected: descriptionSelected,
sceneORAutomationName: automation.name,
type: automation.type,
),
title: automation.name,
onConfirm: () {
context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneConfirmSelectionEvent());
Navigator.pop(context);
},
onDismiss: () {
@@ -194,11 +202,13 @@ class EnableDisableAutomationDialog extends StatefulWidget {
required this.automationId,
required this.descriptionSelected,
required this.sceneORAutomationName,
required this.type,
});
final String automationId;
final String descriptionSelected;
final String sceneORAutomationName;
final String type;
@override
State<EnableDisableAutomationDialog> createState() =>
@@ -226,6 +236,14 @@ class _EnableDisableAutomationDialogState
super.initState();
groupValue =
widget.descriptionSelected == 'Enable' ? 'rule_enable' : 'rule_disable';
context.read<SmartSceneSelectBloc>().add(SmartSceneEnableEvent(
SmartSceneEnable(
entityId: widget.automationId,
actionExecutor: groupValue!,
sceneORAutomationName: widget.sceneORAutomationName,
type: widget.type,
isAutomation: true)));
}
@override
@@ -259,6 +277,7 @@ class _EnableDisableAutomationDialogState
actionExecutor: value!,
sceneORAutomationName:
widget.sceneORAutomationName,
type: widget.type,
isAutomation: true),
));
},
@@ -274,6 +293,7 @@ class _EnableDisableAutomationDialogState
entityId: widget.automationId,
actionExecutor: operation.value,
sceneORAutomationName: widget.sceneORAutomationName,
type: widget.type,
isAutomation: true,
),
));
@@ -25,6 +25,7 @@ class SmartSceneSelectTabToRunList extends StatefulWidget {
class _SmartSceneSelectTabToRunListState
extends State<SmartSceneSelectTabToRunList> {
String groupValue = '';
@override
Widget build(BuildContext context) {
return Column(
@@ -67,6 +68,13 @@ class _SmartSceneSelectTabToRunListState
itemCount: widget.scenes.length,
itemBuilder: (context, index) {
final scene = widget.scenes[index];
final selectedScene =
context.read<SmartSceneSelectBloc>().smartSceneEnable;
if (selectedScene != null) {
if (scene.id == selectedScene.entityId) {
groupValue = scene.id;
}
}
return SceneListTile(
padding: const EdgeInsets.symmetric(horizontal: 10),
leadingWidget: Image.asset(
@@ -84,14 +92,19 @@ class _SmartSceneSelectTabToRunListState
setState(() {
groupValue = value;
});
context
.read<SmartSceneSelectBloc>()
.add(SmartSceneEnableEvent(SmartSceneEnable(
entityId: scene.id,
actionExecutor: 'rule_enable',
sceneORAutomationName: scene.name,
type: scene.type,
isAutomation: false,
)));
context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneConfirmSelectionEvent());
}
}),
onPressed: () {
@@ -104,8 +117,12 @@ class _SmartSceneSelectTabToRunListState
entityId: scene.id,
actionExecutor: 'rule_enable',
sceneORAutomationName: scene.name,
type: scene.type,
isAutomation: false,
)));
context
.read<SmartSceneSelectBloc>()
.add(const SmartSceneConfirmSelectionEvent());
},
);
}),