mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 18:24:54 +00:00
restrict_spaceMemberUser_and_change_SignUpModel
This commit is contained in:
@ -36,34 +36,38 @@ class SceneItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultContainer(
|
||||
onTap: () {
|
||||
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
|
||||
if (disablePlayButton == false) {
|
||||
BlocProvider.of<CreateSceneBloc>(context)
|
||||
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
|
||||
if (HomeCubit.manageScene) {
|
||||
context
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(const SmartSceneClearEvent());
|
||||
if (disablePlayButton == false) {
|
||||
BlocProvider.of<CreateSceneBloc>(context).add(
|
||||
FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false));
|
||||
|
||||
/// the state to set the scene type must be after the fetch
|
||||
BlocProvider.of<CreateSceneBloc>(context)
|
||||
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
|
||||
} else {
|
||||
BlocProvider.of<CreateSceneBloc>(context)
|
||||
.add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: true));
|
||||
/// the state to set the scene type must be after the fetch
|
||||
BlocProvider.of<CreateSceneBloc>(context)
|
||||
.add(const SceneTypeEvent(CreateSceneEnum.tabToRun));
|
||||
} else {
|
||||
BlocProvider.of<CreateSceneBloc>(context).add(
|
||||
FetchSceneTasksEvent(sceneId: scene.id, isAutomation: true));
|
||||
|
||||
/// the state to set the scene type must be after the fetch
|
||||
BlocProvider.of<CreateSceneBloc>(context)
|
||||
.add(const SceneTypeEvent(CreateSceneEnum.deviceStatusChanges));
|
||||
/// the state to set the scene type must be after the fetch
|
||||
BlocProvider.of<CreateSceneBloc>(context)
|
||||
.add(const SceneTypeEvent(CreateSceneEnum.deviceStatusChanges));
|
||||
}
|
||||
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.sceneTasksRoute,
|
||||
arguments: SceneSettingsRouteArguments(
|
||||
sceneType: disablePlayButton == false
|
||||
? CreateSceneEnum.tabToRun.name
|
||||
: CreateSceneEnum.deviceStatusChanges.name,
|
||||
sceneId: scene.id,
|
||||
sceneName: scene.name,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.sceneTasksRoute,
|
||||
arguments: SceneSettingsRouteArguments(
|
||||
sceneType: disablePlayButton == false
|
||||
? CreateSceneEnum.tabToRun.name
|
||||
: CreateSceneEnum.deviceStatusChanges.name,
|
||||
sceneId: scene.id,
|
||||
sceneName: scene.name,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -79,8 +83,11 @@ class SceneItem extends StatelessWidget {
|
||||
height: 32,
|
||||
width: 32,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
Image.asset(Assets.assetsIconsLogo, height: 32, width: 32, fit: BoxFit.fill),
|
||||
errorBuilder: (context, error, stackTrace) => Image.asset(
|
||||
Assets.assetsIconsLogo,
|
||||
height: 32,
|
||||
width: 32,
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
if (disablePlayButton || scene.iconInBytes.isEmpty)
|
||||
SvgPicture.asset(
|
||||
@ -93,7 +100,9 @@ class SceneItem extends StatelessWidget {
|
||||
? IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () {
|
||||
context.read<SceneBloc>().add(SceneTrigger(scene.id, scene.name));
|
||||
context
|
||||
.read<SceneBloc>()
|
||||
.add(SceneTrigger(scene.id, scene.name));
|
||||
},
|
||||
icon: isLoading
|
||||
? const Center(
|
||||
@ -115,11 +124,15 @@ class SceneItem extends StatelessWidget {
|
||||
activeColor: ColorsManager.primaryColor,
|
||||
value: scene.status == 'enable' ? true : false,
|
||||
onChanged: (value) {
|
||||
context.read<SceneBloc>().add(UpdateAutomationStatus(
|
||||
automationStatusUpdate: AutomationStatusUpdate(
|
||||
isEnable: value,
|
||||
spaceUuid: HomeCubit.getInstance().selectedSpace!.id),
|
||||
automationId: scene.id));
|
||||
context.read<SceneBloc>().add(
|
||||
UpdateAutomationStatus(
|
||||
automationStatusUpdate:
|
||||
AutomationStatusUpdate(
|
||||
isEnable: value,
|
||||
spaceUuid: HomeCubit.getInstance()
|
||||
.selectedSpace!
|
||||
.id),
|
||||
automationId: scene.id));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user