mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 18:16:21 +00:00
four_scene
This commit is contained in:
@ -109,7 +109,7 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
emit(FourSceneLoadingState());
|
emit(FourSceneLoadingState());
|
||||||
var response = await DevicesAPI.putDeviceName(
|
var response = await DevicesAPI.putDeviceName(
|
||||||
deviceId: fourSceneId, deviceName: nameController.text);
|
deviceId: fourSceneId, deviceName: nameController.text);
|
||||||
add(FourSceneInitialInfo());
|
add(const FourSceneInitialInfo());
|
||||||
CustomSnackBar.displaySnackBar('Save Successfully');
|
CustomSnackBar.displaySnackBar('Save Successfully');
|
||||||
emit(SaveState());
|
emit(SaveState());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -128,12 +128,10 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
List<dynamic> response = await DevicesAPI.getFourSceneInfo(fourSceneId);
|
List<dynamic> response = await DevicesAPI.getFourSceneInfo(fourSceneId);
|
||||||
fourScene =
|
fourScene =
|
||||||
response.map((item) => FourSceneSwitchModel.fromJson(item)).toList();
|
response.map((item) => FourSceneSwitchModel.fromJson(item)).toList();
|
||||||
print('Fetched response: $fourScene');
|
|
||||||
_rankFourSceneSwitches();
|
_rankFourSceneSwitches();
|
||||||
|
|
||||||
emit(UpdateState(device: deviceStatus));
|
emit(UpdateState(device: deviceStatus));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error in _fetchFourSceneSwitches: $e');
|
|
||||||
emit(FourSceneFailedState(errorMessage: e.toString()));
|
emit(FourSceneFailedState(errorMessage: e.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,17 +78,17 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
FourSwitchsCard(
|
FourSwitchsCard(
|
||||||
title1: _bloc.fourScene.isNotEmpty
|
title1: _bloc.fourScene.isNotEmpty
|
||||||
? _bloc.fourScene[0].switchName
|
? _bloc.fourScene[0].scene.name
|
||||||
: 'title1',
|
: '',
|
||||||
title2: _bloc.fourScene.length > 1
|
title2: _bloc.fourScene.length > 1
|
||||||
? _bloc.fourScene[1].switchName
|
? _bloc.fourScene[0].scene.name
|
||||||
: 'title2',
|
: '',
|
||||||
title3: _bloc.fourScene.length > 2
|
title3: _bloc.fourScene.length > 2
|
||||||
? _bloc.fourScene[2].switchName
|
? _bloc.fourScene[0].scene.name
|
||||||
: 'title3',
|
: '',
|
||||||
title4: _bloc.fourScene.length > 3
|
title4: _bloc.fourScene.length > 3
|
||||||
? _bloc.fourScene[3].switchName
|
? _bloc.fourScene[0].scene.name
|
||||||
: 'title4',
|
: '',
|
||||||
switch1:
|
switch1:
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
_bloc.deviceStatus.switch_backlight == true
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
|
Reference in New Issue
Block a user