mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 04:09:40 +00:00
Refactors SceneView constructor and improves conditional rendering for automation list
This commit is contained in:
@ -16,8 +16,12 @@ import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class SceneView extends StatelessWidget {
|
||||
const SceneView({
|
||||
this.pageType = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final bool pageType;
|
||||
const SceneView({super.key, this.pageType = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -30,9 +34,7 @@ class SceneView extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
final selectedSpace = HomeCubit.getInstance().selectedSpace;
|
||||
if (state is DeleteSceneSuccess) {
|
||||
if (state.success) {
|
||||
_loadScenesAndAutomations(context, selectedSpace);
|
||||
}
|
||||
if (state.success) _loadScenesAndAutomations(context, selectedSpace);
|
||||
}
|
||||
if (state is CreateSceneWithTasks) {
|
||||
if (state.success) {
|
||||
@ -124,19 +126,20 @@ class SceneView extends StatelessWidget {
|
||||
),
|
||||
title: const BodyMedium(text: 'Automation'),
|
||||
children: [
|
||||
automationList.isNotEmpty
|
||||
? SceneGrid(
|
||||
scenes: automationList,
|
||||
loadingSceneId: state.loadingSceneId,
|
||||
disablePlayButton: true,
|
||||
loadingStates: state.loadingStates,
|
||||
)
|
||||
: const Center(
|
||||
child: BodyMedium(
|
||||
text:
|
||||
'No automations have been added yet',
|
||||
),
|
||||
),
|
||||
if (automationList.isNotEmpty)
|
||||
SceneGrid(
|
||||
scenes: automationList,
|
||||
loadingSceneId: state.loadingSceneId,
|
||||
disablePlayButton: true,
|
||||
loadingStates: state.loadingStates,
|
||||
)
|
||||
else
|
||||
const Center(
|
||||
child: BodyMedium(
|
||||
text:
|
||||
'No automations have been added yet',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user