mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
Added latest changes and solved the conflicts
This commit is contained in:
@ -10,9 +10,11 @@ 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';
|
||||||
@ -20,6 +22,7 @@ import 'package:syncrow_app/features/menu/view/menu_view.dart';
|
|||||||
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/navigation/navigation_service.dart';
|
import 'package:syncrow_app/navigation/navigation_service.dart';
|
||||||
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
@ -395,6 +398,15 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
|
|
||||||
emitSafe(NavChangePage());
|
emitSafe(NavChangePage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateDevice(String deviceId) async {
|
||||||
|
try {
|
||||||
|
final response = await DevicesAPI.firmwareDevice(deviceId: deviceId, firmwareVersion: '0');
|
||||||
|
if (response['success'] ?? false) {
|
||||||
|
CustomSnackBar.displaySnackBar('No updates available');
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BottomNavigationBarItem defaultBottomNavBarItem({required String icon, required String label}) {
|
BottomNavigationBarItem defaultBottomNavBarItem({required String icon, required String label}) {
|
||||||
|
@ -14,6 +14,8 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
|
import '../device_appbar.dart';
|
||||||
|
|
||||||
class ACsView extends StatelessWidget {
|
class ACsView extends StatelessWidget {
|
||||||
final DeviceModel? deviceModel;
|
final DeviceModel? deviceModel;
|
||||||
const ACsView({this.deviceModel, super.key});
|
const ACsView({this.deviceModel, super.key});
|
||||||
@ -34,15 +36,20 @@ class ACsView extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: AppBar(
|
appBar: deviceModel != null
|
||||||
backgroundColor: Colors.transparent,
|
? DeviceAppbar(
|
||||||
centerTitle: true,
|
deviceName: deviceModel!.name!,
|
||||||
title: BodyLarge(
|
deviceUuid: deviceModel!.uuid!,
|
||||||
text: deviceModel?.name ?? "ACs",
|
)
|
||||||
fontColor: ColorsManager.primaryColor,
|
: AppBar(
|
||||||
fontWeight: FontsManager.bold,
|
backgroundColor: Colors.transparent,
|
||||||
),
|
centerTitle: true,
|
||||||
),
|
title: BodyLarge(
|
||||||
|
text: deviceModel?.name ?? "ACs",
|
||||||
|
fontColor: ColorsManager.primaryColor,
|
||||||
|
fontWeight: FontsManager.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
|
@ -20,6 +20,8 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
|
import '../device_appbar.dart';
|
||||||
|
|
||||||
class CeilingSensorInterface extends StatelessWidget {
|
class CeilingSensorInterface extends StatelessWidget {
|
||||||
const CeilingSensorInterface({super.key, required this.ceilingSensor});
|
const CeilingSensorInterface({super.key, required this.ceilingSensor});
|
||||||
final DeviceModel ceilingSensor;
|
final DeviceModel ceilingSensor;
|
||||||
@ -49,15 +51,12 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: AppBar(
|
appBar:DeviceAppbar(
|
||||||
backgroundColor: Colors.transparent,
|
deviceName: ceilingSensor.name!,
|
||||||
centerTitle: true,
|
deviceUuid: ceilingSensor.uuid!,
|
||||||
title: BodyLarge(
|
|
||||||
text: ceilingSensor.name ?? "",
|
|
||||||
fontColor: ColorsManager.primaryColor,
|
|
||||||
fontWeight: FontsManager.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
|
44
lib/features/devices/view/widgets/device_appbar.dart
Normal file
44
lib/features/devices/view/widgets/device_appbar.dart
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/popup_menu_widget.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
|
class DeviceAppbar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
|
final String deviceName;
|
||||||
|
final String deviceUuid;
|
||||||
|
final double appBarHeight = 56.0;
|
||||||
|
final void Function()? onPressed;
|
||||||
|
const DeviceAppbar({super.key, required this.deviceName, required this.deviceUuid,this.onPressed});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppBar(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
centerTitle: true,
|
||||||
|
title: BodyLarge(
|
||||||
|
text: deviceName ?? "",
|
||||||
|
fontColor: ColorsManager.primaryColor,
|
||||||
|
fontWeight: FontsManager.bold,
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
IconButton(onPressed: () {
|
||||||
|
showPopupMenu(context: context, items: [
|
||||||
|
PopupMenuItem(
|
||||||
|
onTap: () async {
|
||||||
|
HomeCubit.getInstance().updateDevice(deviceUuid);
|
||||||
|
},
|
||||||
|
value: 'Update',
|
||||||
|
child: const Text('Update'),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}, icon: Icon(Icons.edit))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Size get preferredSize => Size.fromHeight(appBarHeight);
|
||||||
|
}
|
@ -6,6 +6,7 @@ import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_bloc.dart
|
|||||||
import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/gateway_bloc/gateway_state.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/view/widgets/device_appbar.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/room_page_switch.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/room_page_switch.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
@ -37,15 +38,10 @@ class GateWayView extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: AppBar(
|
appBar:DeviceAppbar(
|
||||||
backgroundColor: Colors.transparent,
|
deviceName: 'Gateway',
|
||||||
centerTitle: true,
|
deviceUuid: gatewayObj.uuid!,
|
||||||
title: const BodyLarge(
|
),
|
||||||
text: 'Gateway',
|
|
||||||
fontColor: ColorsManager.primaryColor,
|
|
||||||
fontWeight: FontsManager.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
|
11
lib/features/devices/view/widgets/popup_menu_widget.dart
Normal file
11
lib/features/devices/view/widgets/popup_menu_widget.dart
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
void showPopupMenu(
|
||||||
|
{required BuildContext context, List<PopupMenuEntry<String>>? items}) async {
|
||||||
|
await showMenu(
|
||||||
|
context: context,
|
||||||
|
position: RelativeRect.fromLTRB( MediaQuery.of(context).size.width/2 , 100, 0, 0),
|
||||||
|
items: items!,
|
||||||
|
elevation: 8.0,
|
||||||
|
);
|
||||||
|
}
|
@ -109,7 +109,8 @@ void showDeviceInterface(DeviceModel device, BuildContext context) {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
PageRouteBuilder(
|
PageRouteBuilder(
|
||||||
pageBuilder: (context, animation1, animation2) => DoorInterface(doorLock: device)));
|
pageBuilder: (context, animation1, animation2) => DoorInterface(doorLock: device))
|
||||||
|
);
|
||||||
// navigateToInterface(DoorInterface(doorlock: device), context);
|
// navigateToInterface(DoorInterface(doorlock: device), context);
|
||||||
break;
|
break;
|
||||||
case DeviceType.Gateway:
|
case DeviceType.Gateway:
|
||||||
|
@ -33,9 +33,7 @@ class RoomsSlider extends StatelessWidget {
|
|||||||
text: StringsManager.wizard,
|
text: StringsManager.wizard,
|
||||||
style: context.titleMedium.copyWith(
|
style: context.titleMedium.copyWith(
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
color: HomeCubit.getInstance().selectedRoom == null
|
color: ColorsManager.textPrimaryColor,
|
||||||
? ColorsManager.textPrimaryColor
|
|
||||||
: ColorsManager.textPrimaryColor.withOpacity(.2),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -46,20 +44,15 @@ class RoomsSlider extends StatelessWidget {
|
|||||||
(room) => InkWell(
|
(room) => InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
HomeCubit.getInstance().roomSliderPageChanged(
|
HomeCubit.getInstance().roomSliderPageChanged(
|
||||||
HomeCubit.getInstance()
|
HomeCubit.getInstance().selectedSpace!.rooms!.indexOf(room));
|
||||||
.selectedSpace!
|
|
||||||
.rooms!
|
|
||||||
.indexOf(room));
|
|
||||||
},
|
},
|
||||||
child: TitleMedium(
|
child: TitleMedium(
|
||||||
text: room.name!,
|
text: room.name!,
|
||||||
style: context.titleMedium.copyWith(
|
style: context.titleMedium.copyWith(
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
color:
|
color: HomeCubit.getInstance().selectedRoom == room
|
||||||
HomeCubit.getInstance().selectedRoom == room
|
? ColorsManager.textPrimaryColor
|
||||||
? ColorsManager.textPrimaryColor
|
: ColorsManager.textPrimaryColor.withOpacity(.2),
|
||||||
: ColorsManager.textPrimaryColor
|
|
||||||
.withOpacity(.2),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -6,6 +6,8 @@ import 'package:syncrow_app/features/devices/bloc/smart_door_bloc/smart_door_eve
|
|||||||
import 'package:syncrow_app/features/devices/bloc/smart_door_bloc/smart_door_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/smart_door_bloc/smart_door_state.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/smart_door_model.dart';
|
import 'package:syncrow_app/features/devices/model/smart_door_model.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/popup_menu_widget.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_button.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_button.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_grid.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_grid.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_status_bar.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_status_bar.dart';
|
||||||
@ -16,15 +18,16 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
class DoorInterface extends StatelessWidget {
|
class DoorInterface extends StatelessWidget {
|
||||||
const DoorInterface({super.key, required this.doorLock});
|
|
||||||
|
DoorInterface({super.key, required this.doorLock});
|
||||||
|
|
||||||
final DeviceModel doorLock;
|
final DeviceModel doorLock;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => SmartDoorBloc(deviceId: doorLock.uuid ?? '')..add(InitialEvent()),
|
create: (context) => SmartDoorBloc(deviceId: doorLock.uuid ?? '')..add(InitialEvent()),
|
||||||
child: BlocConsumer<SmartDoorBloc, SmartDoorState>(listener: (context, state) {
|
child: BlocConsumer<SmartDoorBloc, SmartDoorState>(
|
||||||
|
listener: (context, state) {
|
||||||
if (state is FailedState) {
|
if (state is FailedState) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
@ -33,6 +36,7 @@ class DoorInterface extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, builder: (context, state) {
|
}, builder: (context, state) {
|
||||||
SmartDoorModel smartDoorModel = SmartDoorModel(
|
SmartDoorModel smartDoorModel = SmartDoorModel(
|
||||||
unlockFingerprint: 0,
|
unlockFingerprint: 0,
|
||||||
@ -68,14 +72,9 @@ class DoorInterface extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: AppBar(
|
appBar: DeviceAppbar(
|
||||||
backgroundColor: Colors.transparent,
|
deviceName: doorLock.name!,
|
||||||
centerTitle: true,
|
deviceUuid: doorLock.uuid!,
|
||||||
title: BodyLarge(
|
|
||||||
text: doorLock.name ?? "",
|
|
||||||
fontColor: ColorsManager.primaryColor,
|
|
||||||
fontWeight: FontsManager.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
@ -126,3 +125,4 @@ class DoorInterface extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.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/view/widgets/device_appbar.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_screen.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
@ -23,15 +24,20 @@ class ThreeGangInterface extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: AppBar(
|
appBar: gangSwitch != null
|
||||||
backgroundColor: Colors.transparent,
|
? DeviceAppbar(
|
||||||
centerTitle: true,
|
deviceName: gangSwitch!.name!,
|
||||||
title: BodyLarge(
|
deviceUuid: gangSwitch!.uuid!,
|
||||||
text: gangSwitch?.name ?? 'Lights',
|
)
|
||||||
fontColor: ColorsManager.primaryColor,
|
: AppBar(
|
||||||
fontWeight: FontsManager.bold,
|
backgroundColor: Colors.transparent,
|
||||||
),
|
centerTitle: true,
|
||||||
),
|
title: BodyLarge(
|
||||||
|
text: gangSwitch?.name ?? 'Lights',
|
||||||
|
fontColor: ColorsManager.primaryColor,
|
||||||
|
fontWeight: FontsManager.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
|
@ -8,6 +8,7 @@ import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_s
|
|||||||
import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/wall_sensor_bloc/wall_sensor_event.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/wall_sensor_model.dart';
|
import 'package:syncrow_app/features/devices/model/wall_sensor_model.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
@ -56,14 +57,9 @@ class WallMountedInterface extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: AppBar(
|
appBar: DeviceAppbar(
|
||||||
backgroundColor: Colors.transparent,
|
deviceName: deviceModel.name!,
|
||||||
centerTitle: true,
|
deviceUuid: deviceModel.uuid!,
|
||||||
title: BodyLarge(
|
|
||||||
text: deviceModel.name ?? "",
|
|
||||||
fontColor: ColorsManager.primaryColor,
|
|
||||||
fontWeight: FontsManager.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
|
@ -92,6 +92,7 @@ abstract class ApiEndpoints {
|
|||||||
static const String addDeviceToRoom = '$baseUrl/device/room';
|
static const String addDeviceToRoom = '$baseUrl/device/room';
|
||||||
static const String addDeviceToGroup = '$baseUrl/device/group';
|
static const String addDeviceToGroup = '$baseUrl/device/group';
|
||||||
static const String controlDevice = '$baseUrl/device/{deviceUuid}/control';
|
static const String controlDevice = '$baseUrl/device/{deviceUuid}/control';
|
||||||
|
static const String firmwareDevice = '$baseUrl/device/{deviceUuid}/firmware/{firmwareVersion}';
|
||||||
static const String getDevicesByUserId = '$baseUrl/device/user/{userId}';
|
static const String getDevicesByUserId = '$baseUrl/device/user/{userId}';
|
||||||
|
|
||||||
//GET
|
//GET
|
||||||
|
@ -9,6 +9,24 @@ import 'package:syncrow_app/services/api/http_service.dart';
|
|||||||
class DevicesAPI {
|
class DevicesAPI {
|
||||||
static final HTTPService _httpService = HTTPService();
|
static final HTTPService _httpService = HTTPService();
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> firmwareDevice(
|
||||||
|
{required String deviceId, required String firmwareVersion}) async {
|
||||||
|
try {
|
||||||
|
final response = await _httpService.post(
|
||||||
|
path: ApiEndpoints.firmwareDevice
|
||||||
|
.replaceAll('{deviceUuid}', deviceId)
|
||||||
|
.replaceAll('{firmwareVersion}', firmwareVersion),
|
||||||
|
showServerMessage: false,
|
||||||
|
expectedResponseModel: (json) {
|
||||||
|
return json;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return response;
|
||||||
|
} catch (e) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> controlDevice(
|
static Future<Map<String, dynamic>> controlDevice(
|
||||||
DeviceControlModel controlModel, String deviceId) async {
|
DeviceControlModel controlModel, String deviceId) async {
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user