mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 06: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/auth/model/user_model.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/model/device_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/view/widgets/curtains/curtain_view.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));
|
||||
int seconds = 0;
|
||||
try {
|
||||
// The CupertinoTimerPicker widget increments by 60 minutes when the hours are increased.
|
||||
int min = event.duration.inMinutes - event.duration.inHours * 60;
|
||||
seconds = (event.duration.inHours * 60 * 60) + (min * 60);
|
||||
seconds = event.duration.inSeconds;
|
||||
final response = await DevicesAPI.controlDevice(
|
||||
DeviceControlModel(deviceId: threeGangId, code: event.deviceCode, value: seconds),
|
||||
threeGangId);
|
||||
|
||||
@ -54,6 +54,8 @@ class TimerScreen extends StatelessWidget {
|
||||
countNum = state.remainingTime;
|
||||
} else if (state is TimerRunComplete) {
|
||||
countNum = 0;
|
||||
} else if (state is LoadingNewSate) {
|
||||
countNum = 0;
|
||||
}
|
||||
return PopScope(
|
||||
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/shared_widgets/default_scaffold.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||
|
||||
class AssignDeviceView extends StatelessWidget {
|
||||
final String unitId;
|
||||
@ -16,9 +17,14 @@ class AssignDeviceView extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => ManageUnitBloc()..add(FetchDevicesByRoomIdEvent(roomId: roomId)),
|
||||
child: BlocConsumer<ManageUnitBloc, ManageUnitState>(
|
||||
listener: (context, state) {},
|
||||
builder: (context, state) {
|
||||
child: BlocConsumer<ManageUnitBloc, ManageUnitState>(listener: (context, state) {
|
||||
if (state is FetchDeviceByRoomIdState) {
|
||||
if (state.allDevices.isEmpty) {
|
||||
CustomSnackBar.displaySnackBar('No devices available for this user');
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
return DefaultScaffold(
|
||||
title: 'Space Setting',
|
||||
child: state is LoadingState
|
||||
@ -64,8 +70,7 @@ class AssignDeviceView extends StatelessWidget {
|
||||
BlocProvider.of<ManageUnitBloc>(context).add(
|
||||
AssignRoomEvent(
|
||||
deviceId:
|
||||
state.allDevices[index].uuid ??
|
||||
'',
|
||||
state.allDevices[index].uuid ?? '',
|
||||
roomId: roomId));
|
||||
}
|
||||
},
|
||||
|
||||
@ -54,7 +54,8 @@ class RoomsView extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// BlocProvider.of<ManageUnitBloc>(context).add(
|
||||
// FetchDevicesByRoomIdEvent(roomId: roomId));
|
||||
// FetchDevicesByRoomIdEvent(
|
||||
// roomId: state.roomsList[index].id ?? ''));
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AssignDeviceView(
|
||||
|
||||
Reference in New Issue
Block a user