mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 09:49:40 +00:00
fixes issues
This commit is contained in:
@ -210,11 +210,14 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
||||
|
||||
void getSceneByName(
|
||||
GetSceneBySwitchName event, Emitter<SixSceneState> emit) async {
|
||||
emit(SixSceneLoadingState());
|
||||
try {
|
||||
// emit(SixSceneLoadingState());
|
||||
|
||||
final response = await DevicesAPI.getSceneBySwitchName(
|
||||
deviceId: sixSceneId, switchName: event.switchName);
|
||||
selectedFormApiSceneId = response['scene']['uuid'];
|
||||
emit(SuccessState());
|
||||
|
||||
emit(UpdateState(device: deviceStatus));
|
||||
} catch (e) {
|
||||
emit(SixSceneFailedState(errorMessage: e.toString()));
|
||||
@ -292,19 +295,6 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
||||
emit(FaqSearchState(filteredFaqQuestions: _faqQuestions));
|
||||
}
|
||||
|
||||
void _changeName(ChangeNameEvent event, Emitter<SixSceneState> emit) {
|
||||
emit(SixSceneLoadingState());
|
||||
editName = event.value!;
|
||||
if (editName) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
focusNode.requestFocus();
|
||||
});
|
||||
} else {
|
||||
focusNode.unfocus();
|
||||
}
|
||||
emit(NameEditingState(editName: editName));
|
||||
}
|
||||
|
||||
void _toggleNotification(
|
||||
ToggleNotificationEvent event, Emitter<SixSceneState> emit) async {
|
||||
emit(LoadingNewSate(device: deviceStatus));
|
||||
@ -352,21 +342,20 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
||||
Future<void> _onLoadScenes(
|
||||
LoadScenes event, Emitter<SixSceneState> emit) async {
|
||||
emit(SixSceneLoadingState());
|
||||
|
||||
try {
|
||||
if (event.unitId.isNotEmpty) {
|
||||
allScenes = await SceneApi.getScenesByUnitId(
|
||||
event.unitId, event.unit.community.uuid,
|
||||
showInDevice: event.showInDevice);
|
||||
emit(SceneLoaded(
|
||||
allScenes,
|
||||
));
|
||||
filteredScenes = allScenes;
|
||||
} else {
|
||||
emit(const SixSceneFailedState(errorMessage: 'Unit ID is empty'));
|
||||
}
|
||||
allScenes = await SceneApi.getScenesByUnitId(
|
||||
event.unitId, event.unit.community.uuid,
|
||||
showInDevice: event.showInDevice);
|
||||
|
||||
filteredScenes = allScenes;
|
||||
|
||||
emit(SceneLoaded(allScenes));
|
||||
emit(UpdateState(device: deviceStatus));
|
||||
} catch (e) {
|
||||
emit(const SixSceneFailedState(errorMessage: 'Something went wrong'));
|
||||
}
|
||||
emit(SuccessState());
|
||||
}
|
||||
|
||||
bool selecedScene = false;
|
||||
@ -510,6 +499,19 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
||||
//=========================== name setting ===================================
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void _changeName(ChangeNameEvent event, Emitter<SixSceneState> emit) {
|
||||
emit(SixSceneLoadingState());
|
||||
editName = event.value!;
|
||||
if (editName) {
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
focusNode.requestFocus();
|
||||
});
|
||||
} else {
|
||||
focusNode.unfocus();
|
||||
}
|
||||
emit(NameEditingState(editName: editName));
|
||||
}
|
||||
|
||||
Future<void> saveName(
|
||||
SaveNameEvent event, Emitter<SixSceneState> emit) async {
|
||||
if (_validateInputs()) return;
|
||||
|
@ -93,6 +93,7 @@ class SceneLoaded extends SixSceneState {
|
||||
}
|
||||
|
||||
class SearchResultsState extends SixSceneState {}
|
||||
class SuccessState extends SixSceneState {}
|
||||
|
||||
class SaveSelectionSuccessState extends SixSceneState {}
|
||||
|
||||
|
@ -122,7 +122,7 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
||||
|
||||
void getSceneByName(
|
||||
GetSceneBySwitchName event, Emitter<FourSceneState> emit) async {
|
||||
emit(FourSceneLoadingState());
|
||||
// emit(FourSceneLoadingState());
|
||||
try {
|
||||
final response = await DevicesAPI.getSceneBySwitchName(
|
||||
deviceId: fourSceneId, switchName: event.switchName);
|
||||
@ -369,10 +369,9 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
||||
allScenes = await SceneApi.getScenesByUnitId(
|
||||
event.unitId, event.unit.community.uuid,
|
||||
showInDevice: event.showInDevice);
|
||||
emit(SceneLoaded(
|
||||
allScenes,
|
||||
));
|
||||
|
||||
filteredScenes = allScenes;
|
||||
emit(SceneLoaded(allScenes));
|
||||
} else {
|
||||
emit(const FourSceneFailedState(errorMessage: 'Unit ID is empty'));
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class SixSceneUpdatePage extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
UpdateSosContainerWithProgressBar(
|
||||
const UpdateSosContainerWithProgressBar(
|
||||
sosDescription:
|
||||
'Connectivity Issue Resolved Fixed a bug that caused the SOS button to disconnect from the app intermittently.',
|
||||
sosVersion: 'SOS v2.0.5',
|
||||
|
@ -7,13 +7,11 @@ import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_bl
|
||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_event.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_state.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/restart_status_dialog.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_settings_route_arguments.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class SixSelectSceneFourPage extends StatelessWidget {
|
||||
@ -45,9 +43,7 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
return DefaultScaffold(
|
||||
title: 'Select Scene',
|
||||
actions: [_buildSaveButton(context, state, sensorBloc)],
|
||||
child: state is SixSceneLoadingState
|
||||
? _buildLoadingIndicator()
|
||||
: _buildSceneContent(context, sensorBloc, state),
|
||||
child: _buildSceneContent(context, sensorBloc, state),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -68,13 +64,16 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
unit: spaces!.first));
|
||||
}
|
||||
: null,
|
||||
child: BodyMedium(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: canSave
|
||||
? ColorsManager.slidingBlueColor
|
||||
: ColorsManager.primaryTextColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: BodyMedium(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: canSave
|
||||
? ColorsManager.slidingBlueColor
|
||||
: ColorsManager.primaryTextColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -98,7 +97,15 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
_buildSearchBar(sensorBloc),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: _buildSceneGrid(sensorBloc, state),
|
||||
child: state is SixSceneLoadingState
|
||||
? _buildLoadingIndicator()
|
||||
: sensorBloc.filteredScenes.isEmpty
|
||||
? const Center(
|
||||
child: SizedBox(
|
||||
child: BodySmall(text: 'No Scenes available'),
|
||||
),
|
||||
)
|
||||
: _buildSceneGrid(sensorBloc, state),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -137,7 +144,7 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
final scenes = sensorBloc.filteredScenes;
|
||||
|
||||
return GridView.builder(
|
||||
itemCount: scenes.length + 1,
|
||||
itemCount: scenes.length,
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 16,
|
||||
@ -145,38 +152,55 @@ class SixSelectSceneFourPage extends StatelessWidget {
|
||||
mainAxisExtent: 120,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
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));
|
||||
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(unitId: scene.id));
|
||||
},
|
||||
icon: scene.iconInBytes,
|
||||
title: scene.name,
|
||||
);
|
||||
|
||||
sensorBloc.add(SelectSceneEvent(unitId: scene.id));
|
||||
},
|
||||
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(unitId: scene.id));
|
||||
// },
|
||||
// icon: scene.iconInBytes,
|
||||
// title: scene.name,
|
||||
// );
|
||||
// }
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class SelectSwitchDialog extends StatefulWidget {
|
||||
final Function()? cancelTab;
|
||||
final Function(String)? confirmTab;
|
||||
|
@ -11,6 +11,7 @@ import 'package:syncrow_app/features/scene/model/scene_settings_route_arguments.
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||
@ -45,9 +46,7 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
return DefaultScaffold(
|
||||
title: 'Select Scene',
|
||||
actions: [_buildSaveButton(context, state, sensorBloc)],
|
||||
child: state is FourSceneLoadingState
|
||||
? _buildLoadingIndicator()
|
||||
: _buildSceneContent(context, sensorBloc, state),
|
||||
child: _buildSceneContent(context, sensorBloc, state),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -68,13 +67,16 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
unit: spaces!.first));
|
||||
}
|
||||
: null,
|
||||
child: BodyMedium(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: canSave
|
||||
? ColorsManager.slidingBlueColor
|
||||
: ColorsManager.primaryTextColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: BodyMedium(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: canSave
|
||||
? ColorsManager.slidingBlueColor
|
||||
: ColorsManager.primaryTextColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -98,7 +100,15 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
_buildSearchBar(sensorBloc),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
child: _buildSceneGrid(sensorBloc, state),
|
||||
child: state is FourSceneLoadingState
|
||||
? _buildLoadingIndicator()
|
||||
: sensorBloc.filteredScenes.isEmpty
|
||||
? const Center(
|
||||
child: SizedBox(
|
||||
child: BodySmall(text: 'No Scenes available'),
|
||||
),
|
||||
)
|
||||
: _buildSceneGrid(sensorBloc, state),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -137,7 +147,7 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
final scenes = sensorBloc.filteredScenes;
|
||||
|
||||
return GridView.builder(
|
||||
itemCount: scenes.length + 1,
|
||||
itemCount: scenes.length,
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 16,
|
||||
@ -145,38 +155,56 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
||||
mainAxisExtent: 120,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
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));
|
||||
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,
|
||||
);
|
||||
}
|
||||
sensorBloc.add(SelectSceneEvent(selectedSceneId: scene.id));
|
||||
},
|
||||
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,
|
||||
// );
|
||||
// }
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -43,15 +43,15 @@ class SosScreen extends StatelessWidget {
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
var val = await Navigator.of(context).push(
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SosSettings(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == true) {
|
||||
sensor.add(SosInitialDeviseInfo());
|
||||
sensor.add(const SosInitial());
|
||||
}
|
||||
// if (val == null) {
|
||||
// sensor.add(SosInitialDeviseInfo());
|
||||
// sensor.add(const SosInitial());
|
||||
// }
|
||||
},
|
||||
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
||||
),
|
||||
|
Reference in New Issue
Block a user