mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 17:47:53 +00:00
push changes
This commit is contained in:
@ -226,7 +226,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(state.copyWith(isLoading: true));
|
emit(state.copyWith(isLoading: true, errorMessage: null));
|
||||||
|
|
||||||
final actions = state.thenItems.expand((item) {
|
final actions = state.thenItems.expand((item) {
|
||||||
final functions = state.selectedFunctions[item['uniqueCustomId']] ?? [];
|
final functions = state.selectedFunctions[item['uniqueCustomId']] ?? [];
|
||||||
@ -316,7 +316,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit(state.copyWith(isLoading: true));
|
emit(state.copyWith(isLoading: true, errorMessage: null));
|
||||||
|
|
||||||
final conditions = state.ifItems.expand((item) {
|
final conditions = state.ifItems.expand((item) {
|
||||||
final functions = state.selectedFunctions[item['uniqueCustomId']] ?? [];
|
final functions = state.selectedFunctions[item['uniqueCustomId']] ?? [];
|
||||||
@ -920,9 +920,10 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
try {
|
try {
|
||||||
emit(state.copyWith(isLoading: true));
|
emit(state.copyWith(isLoading: true));
|
||||||
if (state.isTabToRun) {
|
if (state.isTabToRun) {
|
||||||
SceneApi.deleteScene(unitUuid: spaceId, sceneId: event.id);
|
SceneApi.deleteScene(unitUuid: spaceId, sceneId: state.sceneId ?? '');
|
||||||
} else {
|
} else {
|
||||||
SceneApi.deleteAutomation(unitUuid: spaceId, automationId: event.id);
|
SceneApi.deleteAutomation(
|
||||||
|
unitUuid: spaceId, automationId: state.automationId ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
add(const LoadScenes(spaceId, communityId));
|
add(const LoadScenes(spaceId, communityId));
|
||||||
@ -983,7 +984,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(state.copyWith(isLoading: true));
|
emit(state.copyWith(isLoading: true, errorMessage: null));
|
||||||
|
|
||||||
final actions = state.thenItems.expand((item) {
|
final actions = state.thenItems.expand((item) {
|
||||||
final functions = state.selectedFunctions[item['uniqueCustomId']] ?? [];
|
final functions = state.selectedFunctions[item['uniqueCustomId']] ?? [];
|
||||||
|
@ -156,10 +156,9 @@ class InitializeRoutineState extends RoutineEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DeleteScene extends RoutineEvent {
|
class DeleteScene extends RoutineEvent {
|
||||||
final String id;
|
const DeleteScene();
|
||||||
const DeleteScene({required this.id});
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [id];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// class DeleteAutomation extends RoutineEvent {
|
// class DeleteAutomation extends RoutineEvent {
|
||||||
|
@ -162,6 +162,10 @@ class SaveRoutineHelper {
|
|||||||
.read<RoutineBloc>()
|
.read<RoutineBloc>()
|
||||||
.add(const CreateSceneEvent());
|
.add(const CreateSceneEvent());
|
||||||
}
|
}
|
||||||
|
if (context.read<RoutineBloc>().state.errorMessage ==
|
||||||
|
null) {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isConfirmEnabled: true,
|
isConfirmEnabled: true,
|
||||||
|
@ -18,7 +18,7 @@ class DeleteSceneWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
showCustomDialog(
|
await showCustomDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Are you sure you want to delete this scene?',
|
message: 'Are you sure you want to delete this scene?',
|
||||||
actions: [
|
actions: [
|
||||||
@ -33,26 +33,31 @@ class DeleteSceneWidget extends StatelessWidget {
|
|||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Cancel',
|
'Cancel',
|
||||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyMedium!
|
||||||
|
.copyWith(
|
||||||
color: ColorsManager.textGray,
|
color: ColorsManager.textGray,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(width: 1, height: 50, color: ColorsManager.greyColor),
|
Container(
|
||||||
|
width: 1, height: 50, color: ColorsManager.greyColor),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.read<RoutineBloc>().add(DeleteScene(
|
context.read<RoutineBloc>().add(const DeleteScene());
|
||||||
id: context.read<RoutineBloc>().state.automationId!,
|
|
||||||
));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop(true);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Confirm',
|
'Confirm',
|
||||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyMedium!
|
||||||
|
.copyWith(
|
||||||
color: ColorsManager.primaryColorWithOpacity,
|
color: ColorsManager.primaryColorWithOpacity,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user