mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 13:04:54 +00:00
Bug fixes
This commit is contained in:
@ -10,11 +10,9 @@ import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
|||||||
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
|
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||||
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
|
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_state.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/smart_door_model.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
|
||||||
|
|||||||
@ -261,9 +261,7 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
|
|||||||
emit(LoadingNewSate(threeGangModel: deviceStatus));
|
emit(LoadingNewSate(threeGangModel: deviceStatus));
|
||||||
int seconds = 0;
|
int seconds = 0;
|
||||||
try {
|
try {
|
||||||
// The CupertinoTimerPicker widget increments by 60 minutes when the hours are increased.
|
seconds = event.duration.inSeconds;
|
||||||
int min = event.duration.inMinutes - event.duration.inHours * 60;
|
|
||||||
seconds = (event.duration.inHours * 60 * 60) + (min * 60);
|
|
||||||
final response = await DevicesAPI.controlDevice(
|
final response = await DevicesAPI.controlDevice(
|
||||||
DeviceControlModel(deviceId: threeGangId, code: event.deviceCode, value: seconds),
|
DeviceControlModel(deviceId: threeGangId, code: event.deviceCode, value: seconds),
|
||||||
threeGangId);
|
threeGangId);
|
||||||
|
|||||||
@ -54,6 +54,8 @@ class TimerScreen extends StatelessWidget {
|
|||||||
countNum = state.remainingTime;
|
countNum = state.remainingTime;
|
||||||
} else if (state is TimerRunComplete) {
|
} else if (state is TimerRunComplete) {
|
||||||
countNum = 0;
|
countNum = 0;
|
||||||
|
} else if (state is LoadingNewSate) {
|
||||||
|
countNum = 0;
|
||||||
}
|
}
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_even
|
|||||||
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart';
|
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
class AssignDeviceView extends StatelessWidget {
|
class AssignDeviceView extends StatelessWidget {
|
||||||
final String unitId;
|
final String unitId;
|
||||||
@ -16,9 +17,14 @@ class AssignDeviceView extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => ManageUnitBloc()..add(FetchDevicesByRoomIdEvent(roomId: roomId)),
|
create: (context) => ManageUnitBloc()..add(FetchDevicesByRoomIdEvent(roomId: roomId)),
|
||||||
child: BlocConsumer<ManageUnitBloc, ManageUnitState>(
|
child: BlocConsumer<ManageUnitBloc, ManageUnitState>(listener: (context, state) {
|
||||||
listener: (context, state) {},
|
if (state is FetchDeviceByRoomIdState) {
|
||||||
builder: (context, state) {
|
if (state.allDevices.isEmpty) {
|
||||||
|
CustomSnackBar.displaySnackBar('No devices available for this user');
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, builder: (context, state) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Space Setting',
|
title: 'Space Setting',
|
||||||
child: state is LoadingState
|
child: state is LoadingState
|
||||||
@ -64,8 +70,7 @@ class AssignDeviceView extends StatelessWidget {
|
|||||||
BlocProvider.of<ManageUnitBloc>(context).add(
|
BlocProvider.of<ManageUnitBloc>(context).add(
|
||||||
AssignRoomEvent(
|
AssignRoomEvent(
|
||||||
deviceId:
|
deviceId:
|
||||||
state.allDevices[index].uuid ??
|
state.allDevices[index].uuid ?? '',
|
||||||
'',
|
|
||||||
roomId: roomId));
|
roomId: roomId));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -54,7 +54,8 @@ class RoomsView extends StatelessWidget {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// BlocProvider.of<ManageUnitBloc>(context).add(
|
// BlocProvider.of<ManageUnitBloc>(context).add(
|
||||||
// FetchDevicesByRoomIdEvent(roomId: roomId));
|
// FetchDevicesByRoomIdEvent(
|
||||||
|
// roomId: state.roomsList[index].id ?? ''));
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => AssignDeviceView(
|
builder: (context) => AssignDeviceView(
|
||||||
|
|||||||
Reference in New Issue
Block a user