mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-24 20:37:55 +00:00
fixes issues
This commit is contained in:
@@ -37,8 +37,10 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
final sensorBloc = BlocProvider.of<SixSceneBloc>(context);
|
||||
if (state is SaveSelectionSuccessState) {
|
||||
Navigator.of(context).pop(true);
|
||||
Navigator.of(context).pop(true);
|
||||
Future.delayed(const Duration(milliseconds: 250), () {
|
||||
Navigator.of(context).pop(true);
|
||||
Navigator.of(context).pop(true);
|
||||
});
|
||||
}
|
||||
return DefaultScaffold(
|
||||
title: 'Select Scene',
|
||||
@@ -163,7 +165,8 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
disablePlayButton: false,
|
||||
onChanged: (isSelected) {
|
||||
sensorBloc.add(SelectOptionEvent(selectedOption: scene.id));
|
||||
sensorBloc.add(SelectSceneEvent(unitId: scene.id));
|
||||
sensorBloc.add(SelectSceneEvent(
|
||||
selectedSceneId: scene.id, isSelected: isSelected));
|
||||
},
|
||||
icon: scene.iconInBytes,
|
||||
title: scene.name,
|
||||
|
||||
@@ -196,12 +196,14 @@ class SixSceneScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (value == true) {
|
||||
_bloc.add(const SixSceneInitial());
|
||||
_bloc.add(
|
||||
const SixSceneInitialInfo());
|
||||
_bloc.add(
|
||||
const SexSceneSwitchInitial());
|
||||
Future.delayed(
|
||||
const Duration(
|
||||
milliseconds: 250), () {
|
||||
_bloc.add(
|
||||
const SexSceneSwitchInitial());
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
|
||||
@@ -175,12 +175,14 @@ class FourSceneScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (value == true) {
|
||||
_bloc.add(const FourSceneInitial());
|
||||
_bloc.add(
|
||||
const FourSceneInitialInfo());
|
||||
_bloc.add(
|
||||
const FourSceneSwitchInitial());
|
||||
Future.delayed(
|
||||
const Duration(
|
||||
milliseconds: 250), () {
|
||||
_bloc.add(
|
||||
const FourSceneSwitchInitial());
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
|
||||
@@ -37,8 +37,10 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
final sensorBloc = BlocProvider.of<FourSceneBloc>(context);
|
||||
if (state is SaveSelectionSuccessState) {
|
||||
Navigator.of(context).pop(true);
|
||||
Navigator.of(context).pop(true);
|
||||
Future.delayed(const Duration(milliseconds: 250), () {
|
||||
Navigator.of(context).pop(true);
|
||||
Navigator.of(context).pop(true);
|
||||
});
|
||||
}
|
||||
return DefaultScaffold(
|
||||
title: 'Select Scene',
|
||||
@@ -153,55 +155,25 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final scene = scenes[index];
|
||||
|
||||
// Check if this scene is currently selected
|
||||
bool isSelected = scene.id ==
|
||||
(state is SceneSelectionUpdatedState
|
||||
? state.selectedSceneId
|
||||
: sensorBloc.selectedFormApiSceneId);
|
||||
|
||||
return SceneItem(
|
||||
id: scene.id,
|
||||
value: isSelected,
|
||||
value: isSelected, // Pass isSelected to the SceneItem
|
||||
disablePlayButton: false,
|
||||
onChanged: (isSelected) {
|
||||
onChanged: (newSelection) {
|
||||
// If selected, assign the scene
|
||||
sensorBloc.add(SelectOptionEvent(selectedOption: scene.id));
|
||||
|
||||
sensorBloc.add(SelectSceneEvent(selectedSceneId: scene.id));
|
||||
sensorBloc.add(SelectSceneEvent(selectedSceneId: scene.id,isSelected:newSelection));
|
||||
},
|
||||
icon: scene.iconInBytes,
|
||||
title: scene.name,
|
||||
);
|
||||
|
||||
// if (index == scenes.length) {
|
||||
// return InkWell(
|
||||
// onTap: () => Navigator.pushNamed(
|
||||
// NavigationService.navigatorKey.currentContext!,
|
||||
// Routes.sceneTasksRoute,
|
||||
// arguments: SceneSettingsRouteArguments(
|
||||
// sceneType: '',
|
||||
// sceneId: '',
|
||||
// sceneName: '',
|
||||
// ),
|
||||
// ),
|
||||
// child: CreateSceneItem(),
|
||||
// );
|
||||
// } else {
|
||||
// final scene = scenes[index];
|
||||
// bool isSelected = scene.id ==
|
||||
// (state is SceneSelectionUpdatedState
|
||||
// ? state.selectedSceneId
|
||||
// : sensorBloc.selectedFormApiSceneId);
|
||||
// return SceneItem(
|
||||
// id: scene.id,
|
||||
// value: isSelected,
|
||||
// disablePlayButton: false,
|
||||
// onChanged: (isSelected) {
|
||||
// sensorBloc.add(SelectOptionEvent(selectedOption: scene.id));
|
||||
|
||||
// sensorBloc.add(SelectSceneEvent(selectedSceneId: scene.id));
|
||||
// },
|
||||
// icon: scene.iconInBytes,
|
||||
// title: scene.name,
|
||||
// );
|
||||
// }
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -317,3 +289,37 @@ class CreateSceneItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (index == scenes.length) {
|
||||
// return InkWell(
|
||||
// onTap: () => Navigator.pushNamed(
|
||||
// NavigationService.navigatorKey.currentContext!,
|
||||
// Routes.sceneTasksRoute,
|
||||
// arguments: SceneSettingsRouteArguments(
|
||||
// sceneType: '',
|
||||
// sceneId: '',
|
||||
// sceneName: '',
|
||||
// ),
|
||||
// ),
|
||||
// child: CreateSceneItem(),
|
||||
// );
|
||||
// } else {
|
||||
// final scene = scenes[index];
|
||||
// bool isSelected = scene.id ==
|
||||
// (state is SceneSelectionUpdatedState
|
||||
// ? state.selectedSceneId
|
||||
// : sensorBloc.selectedFormApiSceneId);
|
||||
// return SceneItem(
|
||||
// id: scene.id,
|
||||
// value: isSelected,
|
||||
// disablePlayButton: false,
|
||||
// onChanged: (isSelected) {
|
||||
// sensorBloc.add(SelectOptionEvent(selectedOption: scene.id));
|
||||
|
||||
// sensorBloc.add(SelectSceneEvent(selectedSceneId: scene.id));
|
||||
// },
|
||||
// icon: scene.iconInBytes,
|
||||
// title: scene.name,
|
||||
// );
|
||||
// }
|
||||
Reference in New Issue
Block a user