mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
Update device interfaces and add new doors list view widget
- Add a new widget 'DoorsListView' for displaying a list of smart doors - Update the navigation method to devices interfaces in 'RoomPageSwitch' widget - Add battery and doorlock icons to auto generated assets
This commit is contained in:
@ -14,7 +14,7 @@ import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.
|
||||
import 'package:syncrow_app/features/devices/view/widgets/gateway/gateway_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/lights/lights_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/doors_list_view.dart';
|
||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||
@ -84,7 +84,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
case DeviceType.LightBulb:
|
||||
return const LightsView();
|
||||
case DeviceType.DoorLock:
|
||||
return const DoorView();
|
||||
return const DoorsListView();
|
||||
case DeviceType.Curtain:
|
||||
return const CurtainView();
|
||||
// case DeviceType.ThreeGang:
|
||||
|
@ -12,9 +12,9 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||
|
||||
class AcInterface extends StatelessWidget {
|
||||
const AcInterface({super.key, required this.deviceModel});
|
||||
const AcInterface({super.key, required this.ac});
|
||||
|
||||
final DeviceModel deviceModel;
|
||||
final DeviceModel ac;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,7 +43,7 @@ class AcInterface extends StatelessWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
centerTitle: true,
|
||||
title: BodyLarge(
|
||||
text: deviceModel.name ?? "",
|
||||
text: ac.name ?? "",
|
||||
fontColor: ColorsManager.primaryColor,
|
||||
fontWeight: FontsManager.bold,
|
||||
),
|
||||
@ -75,7 +75,7 @@ class AcInterface extends StatelessWidget {
|
||||
maxHeight: 380,
|
||||
),
|
||||
child: AcInterfaceTempUnit(
|
||||
acDevice: deviceModel,
|
||||
acDevice: ac,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
@ -86,7 +86,7 @@ class AcInterface extends StatelessWidget {
|
||||
maxHeight: 120,
|
||||
),
|
||||
child: AcInterfaceControls(
|
||||
deviceModel: deviceModel,
|
||||
deviceModel: ac,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -55,7 +55,7 @@ class ACsView extends StatelessWidget {
|
||||
),
|
||||
child: SizedBox.expand(
|
||||
child: selectedAC != null
|
||||
? AcInterface(deviceModel: selectedAC)
|
||||
? AcInterface(ac: selectedAC)
|
||||
: const ACsList(),
|
||||
),
|
||||
),
|
||||
|
@ -1,3 +1,9 @@
|
||||
/// This widget represents a switch for a device on the room page.
|
||||
///
|
||||
/// This widget displays the icon and name of the device, along with a switch
|
||||
/// to control its state. Tapping on the widget opens the device interface.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
@ -5,6 +11,7 @@ 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/view/widgets/ACs/ac_interface.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/lights/light_interface.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_interface.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
@ -25,58 +32,7 @@ class RoomPageSwitch extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
switch (device.productType) {
|
||||
case DeviceType.AC:
|
||||
{
|
||||
print("AC");
|
||||
Navigator.push(
|
||||
context,
|
||||
CustomPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => DevicesCubit.getInstance(),
|
||||
child: AcInterface(deviceModel: device),
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
}
|
||||
case DeviceType.WallSensor:
|
||||
break;
|
||||
case DeviceType.CeilingSensor:
|
||||
break;
|
||||
case DeviceType.Curtain:
|
||||
break;
|
||||
case DeviceType.Blind:
|
||||
break;
|
||||
case DeviceType.DoorLock:
|
||||
break;
|
||||
case DeviceType.Gateway:
|
||||
break;
|
||||
case DeviceType.LightBulb:
|
||||
Navigator.push(
|
||||
context,
|
||||
CustomPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => DevicesCubit.getInstance(),
|
||||
child: LightInterface(light: device),
|
||||
),
|
||||
),
|
||||
);
|
||||
case DeviceType.ThreeGang:
|
||||
Navigator.push(
|
||||
context,
|
||||
CustomPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => DevicesCubit.getInstance(),
|
||||
child: ThreeGangInterface(
|
||||
gangSwitch: device,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
showDeviceInterface(device, context);
|
||||
},
|
||||
child: DefaultContainer(
|
||||
child: Padding(
|
||||
@ -119,3 +75,48 @@ class RoomPageSwitch extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows the device interface based on the product type of the device.
|
||||
///
|
||||
/// The [device] parameter represents the device model.
|
||||
void showDeviceInterface(DeviceModel device, BuildContext context) {
|
||||
switch (device.productType) {
|
||||
case DeviceType.AC:
|
||||
navigateToInterface(AcInterface(ac: device), context);
|
||||
break;
|
||||
case DeviceType.WallSensor:
|
||||
break;
|
||||
case DeviceType.CeilingSensor:
|
||||
break;
|
||||
case DeviceType.Curtain:
|
||||
break;
|
||||
case DeviceType.Blind:
|
||||
break;
|
||||
case DeviceType.DoorLock:
|
||||
navigateToInterface(DoorInterface(doorlock: device), context);
|
||||
break;
|
||||
case DeviceType.Gateway:
|
||||
break;
|
||||
case DeviceType.LightBulb:
|
||||
navigateToInterface(LightInterface(light: device), context);
|
||||
case DeviceType.ThreeGang:
|
||||
navigateToInterface(ThreeGangInterface(gangSwitch: device), context);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
/// Navigates to the specified device interface.
|
||||
///
|
||||
/// The [interface] parameter represents the widget interface.
|
||||
void navigateToInterface(Widget interface, context) {
|
||||
Navigator.push(
|
||||
context,
|
||||
CustomPageRoute(
|
||||
builder: (context) => BlocProvider(
|
||||
create: (context) => DevicesCubit.getInstance(),
|
||||
child: interface,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DoorView extends StatelessWidget {
|
||||
const DoorView({super.key});
|
||||
class DoorsListView extends StatelessWidget {
|
||||
const DoorsListView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
@ -3,6 +3,84 @@ class Assets {
|
||||
Assets._();
|
||||
|
||||
static const String assetsIconsSettings = 'assets/icons/settings.svg';
|
||||
static const String dmOffPerOffchargOfflowOffpmOffstChargeddmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstChargeddmOff.svg';
|
||||
static const String dmOffPerOffchargOfflowOffpmOffstDefaultdmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstDefaultdmOff.svg';
|
||||
static const String dmOffPerOffchargOfflowOffpmOnstChargeddmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOfflowOffpmOnstChargeddmOff.svg';
|
||||
static const String dmOffPerOffchargOfflowOnpmOffstDefaultdmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOfflowOnpmOffstDefaultdmOff.svg';
|
||||
static const String dmOffPerOffchargOfflowOnpmOnstDefaultdmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOfflowOnpmOnstDefaultdmOff.svg';
|
||||
static const String dmOffPerOffchargOnlowOffpmOffstChargeddmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOnlowOffpmOffstChargeddmOff.svg';
|
||||
static const String dmOffPerOffchargOnlowOnpmOffstlowBatterydmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOnlowOnpmOffstlowBatterydmOff.svg';
|
||||
static const String dmOffPerOffchargOnlowOnpmOnstlowpmdmOff =
|
||||
'assets/icons/battery/dmOff/perOffchargOnlowOnpmOnstlowpmdmOff.svg';
|
||||
static const String dmOffPerOnchargOfflowOffpmOffstChargeddmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstChargeddmOff.svg';
|
||||
static const String dmOffPerOnchargOfflowOffpmOffstDefaultdmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstDefaultdmOff.svg';
|
||||
static const String dmOffPerOnchargOfflowOffpmOnstChargeddmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOfflowOffpmOnstChargeddmOff.svg';
|
||||
static const String dmOffPerOnchargOfflowOnpmOffstDefaultdmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOfflowOnpmOffstDefaultdmOff.svg';
|
||||
static const String dmOffPerOnchargOfflowOnpmOnstDefaultdmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOfflowOnpmOnstDefaultdmOff.svg';
|
||||
static const String dmOffPerOnchargOnlowOffpmOffstChargeddmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOnlowOffpmOffstChargeddmOff.svg';
|
||||
static const String dmOffPerOnchargOnlowOnpmOffstlowBatterydmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOnlowOnpmOffstlowBatterydmOff.svg';
|
||||
static const String dmOffPerOnchargOnlowOnpmOnstlowpmdmOff =
|
||||
'assets/icons/battery/dmOff/perOnchargOnlowOnpmOnstlowpmdmOff.svg';
|
||||
static const String dmOnPerOffchargOfflowOffpmOffstChargeddmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstChargeddmOn.svg';
|
||||
static const String dmOnPerOffchargOfflowOffpmOffstDefaultdmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstDefaultdmOn.svg';
|
||||
static const String dmOnPerOffchargOfflowOffpmOnstChargeddmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOfflowOffpmOnstChargeddmOn.svg';
|
||||
static const String dmOnPerOffchargOfflowOnpmOffstDefaultdmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOfflowOnpmOffstDefaultdmOn.svg';
|
||||
static const String dmOnPerOffchargOfflowOnpmOnstDefaultdmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOfflowOnpmOnstDefaultdmOn.svg';
|
||||
static const String dmOnPerOffchargOnlowOffpmOffstChargeddmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOnlowOffpmOffstChargeddmOn.svg';
|
||||
static const String dmOnPerOffchargOnlowOnpmOffstlowBatterydmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOnlowOnpmOffstlowBatterydmOn.svg';
|
||||
static const String dmOnPerOffchargOnlowOnpmOnstlowpmdmOn =
|
||||
'assets/icons/battery/dmOn/perOffchargOnlowOnpmOnstlowpmdmOn.svg';
|
||||
static const String dmOnPerOnchargOfflowOffpmOffstChargeddmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstChargeddmOn.svg';
|
||||
static const String dmOnPerOnchargOfflowOffpmOffstDefaultdmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstDefaultdmOn.svg';
|
||||
static const String dmOnPerOnchargOfflowOffpmOnstChargeddmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOfflowOffpmOnstChargeddmOn.svg';
|
||||
static const String dmOnPerOnchargOfflowOnpmOffstDefaultdmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOfflowOnpmOffstDefaultdmOn.svg';
|
||||
static const String dmOnPerOnchargOfflowOnpmOnstDefaultdmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOfflowOnpmOnstDefaultdmOn.svg';
|
||||
static const String dmOnPerOnchargOnlowOffpmOffstChargeddmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOnlowOffpmOffstChargeddmOn.svg';
|
||||
static const String dmOnPerOnchargOnlowOnpmOffstlowBatterydmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOnlowOnpmOffstlowBatterydmOn.svg';
|
||||
static const String dmOnPerOnchargOnlowOnpmOnstlowpmdmOn =
|
||||
'assets/icons/battery/dmOn/perOnchargOnlowOnpmOnstlowpmdmOn.svg';
|
||||
static const String doorlockAssetsBatteryIndicator =
|
||||
'assets/icons/doorlock-assets/BatteryIndicator.svg';
|
||||
static const String doorlockAssetsDoorlockButtonOne =
|
||||
'assets/icons/doorlock-assets/doorlock-button-one.svg';
|
||||
static const String doorlockAssetsDoorlockButtonTwo =
|
||||
'assets/icons/doorlock-assets/doorlock-button-two.svg';
|
||||
static const String doorlockAssetsMembersManagement =
|
||||
'assets/icons/doorlock-assets/members-management.svg';
|
||||
static const String doorlockAssetsSmartLinkage =
|
||||
'assets/icons/doorlock-assets/smart-linkage.svg';
|
||||
static const String doorlockAssetsTemporaryPassword =
|
||||
'assets/icons/doorlock-assets/temporary-password.svg';
|
||||
static const String doorlockAssetsUnlockingRecords =
|
||||
'assets/icons/doorlock-assets/unlocking-records.svg';
|
||||
static const String fontsAftikaRegular = 'assets/fonts/AftikaRegular.ttf';
|
||||
static const String icons3GangSwitch = 'assets/icons/3GangSwitch.svg';
|
||||
static const String iconsAC = 'assets/icons/AC.svg';
|
||||
@ -60,6 +138,7 @@ class Assets {
|
||||
static const String iconsVector = 'assets/icons/Vector.svg';
|
||||
static const String iconsVector1 = 'assets/icons/Vector-1.svg';
|
||||
static const String iconsVoltMeter = 'assets/icons/volt-meter.svg';
|
||||
static const String iconsWifi = 'assets/icons/Wifi.svg';
|
||||
static const String iconsWindyMode = 'assets/icons/windyMode.svg';
|
||||
static const String iconsWinter = 'assets/icons/Winter.svg';
|
||||
static const String iconsWinter1 = 'assets/icons/winter1.jpg';
|
||||
|
Reference in New Issue
Block a user