push changes

This commit is contained in:
ashrafzarkanisala
2024-11-30 20:43:21 +03:00
parent 8d388ac482
commit ce6e7700bc
14 changed files with 852 additions and 305 deletions

View File

@ -54,23 +54,27 @@ class SaveRoutineHelper {
),
if (state.isAutomation)
...state.ifItems.map((item) {
final functions =
state.selectedFunctions[item['uniqueCustomId']] ?? [];
final functions = state.selectedFunctions[
item['uniqueCustomId']] ??
[];
return ListTile(
leading: SvgPicture.asset(
item['imagePath'],
width: 22,
height: 22,
),
title:
Text(item['title'], style: const TextStyle(fontSize: 14)),
title: Text(item['title'],
style: const TextStyle(fontSize: 14)),
subtitle: Wrap(
children: functions
.map((f) => Text(
'${f.operationName}: ${f.value}, ',
style: const TextStyle(
color: ColorsManager.grayColor, fontSize: 8),
overflow: TextOverflow.ellipsis,
color: ColorsManager
.grayColor,
fontSize: 8),
overflow:
TextOverflow.ellipsis,
maxLines: 3,
))
.toList(),
@ -95,22 +99,25 @@ class SaveRoutineHelper {
),
const SizedBox(height: 8),
...state.thenItems.map((item) {
final functions =
state.selectedFunctions[item['uniqueCustomId']] ?? [];
final functions = state.selectedFunctions[
item['uniqueCustomId']] ??
[];
return ListTile(
leading: SvgPicture.asset(
item['imagePath'],
width: 22,
height: 22,
),
title:
Text(item['title'], style: const TextStyle(fontSize: 14)),
title: Text(item['title'],
style: const TextStyle(fontSize: 14)),
subtitle: Wrap(
children: functions
.map((f) => Text(
'${f.operationName}: ${f.value}, ',
style: const TextStyle(
color: ColorsManager.grayColor, fontSize: 8),
color:
ColorsManager.grayColor,
fontSize: 8),
overflow: TextOverflow.ellipsis,
maxLines: 3,
))
@ -136,9 +143,25 @@ class SaveRoutineHelper {
onCancel: () => Navigator.pop(context, false),
onConfirm: () {
if (state.isAutomation) {
context.read<RoutineBloc>().add(const CreateAutomationEvent());
if (state.automationId != null) {
context
.read<RoutineBloc>()
.add(const UpdateAutomation());
} else {
context
.read<RoutineBloc>()
.add(const CreateAutomationEvent());
}
} else {
context.read<RoutineBloc>().add(const CreateSceneEvent());
if (state.sceneId != null) {
context
.read<RoutineBloc>()
.add(const UpdateScene());
} else {
context
.read<RoutineBloc>()
.add(const CreateSceneEvent());
}
}
Navigator.pop(context, true);