fix load scenes after creation

This commit is contained in:
ashrafzarkanisala
2024-07-01 20:05:05 +03:00
parent f9a2de9769
commit 16a336ab09
2 changed files with 9 additions and 1 deletions
+6
View File
@@ -26,6 +26,12 @@ class SceneView extends StatelessWidget {
.add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!));
}
}
if (state is CreateSceneWithTasks) {
if (state.success == true) {
BlocProvider.of<SceneBloc>(context)
.add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!));
}
}
return BlocListener<SceneBloc, SceneState>(
listener: (context, state) {
if (state is SceneTriggerSuccess) {
@@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.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/scene_bloc/scene_bloc.dart';
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
import 'package:syncrow_app/features/scene/helper/scene_logic_helper.dart';
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
@@ -45,7 +48,6 @@ class _CreateSceneSaveButtonState extends State<CreateSceneSaveButton>
if (state.success == true) {
Navigator.pop(context);
Navigator.pop(context);
context.showCustomSnackbar(
message: 'Scene created successfully',
icon: const Icon(