Merged with SP-203

This commit is contained in:
Abdullah Alassaf
2024-07-25 14:15:06 +03:00
46 changed files with 1973 additions and 811 deletions

View File

@ -29,24 +29,23 @@ class SceneView extends StatelessWidget {
if (state.success) {
BlocProvider.of<SceneBloc>(context)
.add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!));
BlocProvider.of<SceneBloc>(context).add(
LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!));
BlocProvider.of<SceneBloc>(context)
.add(LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!));
}
}
if (state is CreateSceneWithTasks) {
if (state.success == true) {
BlocProvider.of<SceneBloc>(context)
.add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!));
BlocProvider.of<SceneBloc>(context).add(
LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!));
BlocProvider.of<SceneBloc>(context)
.add(LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!));
}
}
return BlocListener<SceneBloc, SceneState>(
listener: (context, state) {
if (state is SceneTriggerSuccess) {
context.showCustomSnackbar(
message:
'Scene ${state.sceneName} triggered successfully!');
message: 'Scene ${state.sceneName} triggered successfully!');
}
},
child: HomeCubit.getInstance().spaces?.isEmpty ?? true
@ -76,32 +75,27 @@ class SceneView extends StatelessWidget {
return pageType
? Expanded(
child: SceneListview(
scenes: state.scenes,
scenes: scenes,
loadingSceneId: state.loadingSceneId,
))
: Expanded(
child: ListView(
children: [
ExpansionTile(
tilePadding:
const EdgeInsets.symmetric(
horizontal: 6),
tilePadding: const EdgeInsets.symmetric(horizontal: 6),
initiallyExpanded: true,
iconColor: ColorsManager.grayColor,
title: const BodySmall(
text: 'Tap to run routines'),
title: const BodySmall(text: 'Tap to run routines'),
children: [
scenes.isNotEmpty
? SceneGrid(
scenes: scenes,
loadingSceneId:
state.loadingSceneId,
loadingSceneId: state.loadingSceneId,
disablePLayButton: false,
)
: const Center(
child: BodyMedium(
text:
'No scenes have been added yet',
text: 'No scenes have been added yet',
),
),
const SizedBox(
@ -112,23 +106,18 @@ class SceneView extends StatelessWidget {
ExpansionTile(
initiallyExpanded: true,
iconColor: ColorsManager.grayColor,
tilePadding:
const EdgeInsets.symmetric(
horizontal: 6),
title: const BodySmall(
text: 'Automation'),
tilePadding: const EdgeInsets.symmetric(horizontal: 6),
title: const BodySmall(text: 'Automation'),
children: [
automationList.isNotEmpty
? SceneGrid(
scenes: automationList,
loadingSceneId:
state.loadingSceneId,
loadingSceneId: state.loadingSceneId,
disablePLayButton: true,
)
: const Center(
child: BodyMedium(
text:
'No automations have been added yet',
text: 'No automations have been added yet',
),
),
const SizedBox(