bug fixes and read sensors states

This commit is contained in:
Abdullah Alassaf
2024-06-06 11:14:25 +03:00
parent 631ba53d7a
commit 76f5c6d325
20 changed files with 561 additions and 547 deletions
@@ -1,4 +1,5 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart';
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart';
@@ -101,6 +102,7 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
final roomsList = await SpacesAPI.getRoomsBySpaceId(event.unitId);
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
await HomeCubit.getInstance().fetchUnitsByUserId();
} else {
emit(const ErrorState(message: 'Something went wrong'));
}
@@ -40,8 +40,9 @@ class HomeSettingsView extends StatelessWidget {
Flexible(
child: TextField(
textAlign: TextAlign.end,
readOnly: true,
decoration: InputDecoration(
hintText: 'Enter Name',
hintText: space?.name ?? 'Enter Name',
hintStyle: context.bodyMedium.copyWith(color: Colors.grey),
border: InputBorder.none,
),
@@ -55,15 +56,16 @@ class HomeSettingsView extends StatelessWidget {
height: 1,
color: ColorsManager.greyColor,
),
Container(
width: MediaQuery.sizeOf(context).width,
child: GestureDetector(
onTap: () {
Navigator.of(context).push(CustomPageRoute(
builder: (context) => RoomsView(
unitId: space?.id ?? '',
)));
},
GestureDetector(
onTap: () {
Navigator.of(context).push(CustomPageRoute(
builder: (context) => RoomsView(
unitId: space?.id ?? '',
)));
},
child: Container(
width: MediaQuery.sizeOf(context).width,
padding: const EdgeInsets.all(4),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [