mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-27 07:17:55 +00:00
adding asset images
This commit is contained in:
@@ -11,6 +11,7 @@ mixin SceneOperationsDataHelper {
|
||||
required List<FunctionModel> functions,
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
switch (type) {
|
||||
case DeviceType.LightBulb:
|
||||
@@ -19,6 +20,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.CeilingSensor:
|
||||
return ceilingSensorFunctions(
|
||||
@@ -26,6 +28,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.WallSensor:
|
||||
return wallSensorFunctions(
|
||||
@@ -33,6 +36,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.AC:
|
||||
return acFunctions(
|
||||
@@ -40,6 +44,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.DoorLock:
|
||||
return doorLockFunctions(
|
||||
@@ -47,6 +52,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.Curtain:
|
||||
return curtainFunctions(
|
||||
@@ -54,6 +60,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.ThreeGang:
|
||||
return threeGangFunctions(
|
||||
@@ -61,6 +68,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
case DeviceType.Gateway:
|
||||
return gatewayFunctions(
|
||||
@@ -68,6 +76,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
default:
|
||||
return lightBulbFunctions(
|
||||
@@ -75,6 +84,7 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
functionValue: null,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -108,6 +118,7 @@ mixin SceneOperationsDataHelper {
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required dynamic functionValue,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
@@ -177,7 +188,8 @@ mixin SceneOperationsDataHelper {
|
||||
{required List<FunctionModel> functions,
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue}) {
|
||||
required functionValue,
|
||||
required bool isAutomation}) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -186,7 +198,28 @@ mixin SceneOperationsDataHelper {
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
if (isAutomation) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsIconsDoorLock,
|
||||
operationName: 'Set Door lock Normal Open',
|
||||
functionValue: functionValue,
|
||||
code: 'normal_open_switch',
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF,
|
||||
description: "OFF",
|
||||
value: false),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
@@ -210,6 +243,7 @@ mixin SceneOperationsDataHelper {
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
@@ -377,7 +411,8 @@ mixin SceneOperationsDataHelper {
|
||||
{required List<FunctionModel> functions,
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue}) {
|
||||
required functionValue,
|
||||
required bool isAutomation}) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -386,6 +421,7 @@ mixin SceneOperationsDataHelper {
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
@@ -444,6 +480,7 @@ mixin SceneOperationsDataHelper {
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
@@ -530,6 +567,7 @@ mixin SceneOperationsDataHelper {
|
||||
required String deviceId,
|
||||
required String deviceName,
|
||||
required functionValue,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
|
||||
@@ -58,7 +58,17 @@ class CreateSceneView extends StatelessWidget {
|
||||
titleString: StringsManager.whenDeviceStatusChanges,
|
||||
subtitleString: StringsManager.whenUnusualActivityIsDetected,
|
||||
),
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.sceneControlDevicesRoute,
|
||||
arguments: SceneSettingsRouteArguments(
|
||||
sceneType: CreateSceneEnum.deviceStatusChanges.name,
|
||||
sceneId: '',
|
||||
sceneName: '',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -27,7 +27,11 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
/// this whole widget needs a refactor later
|
||||
///
|
||||
/// static functions based on type
|
||||
final device = ModalRoute.of(context)?.settings.arguments as DeviceModel;
|
||||
final device = (ModalRoute.of(context)?.settings.arguments as Map)['device']
|
||||
as DeviceModel;
|
||||
|
||||
final isAutomation = (ModalRoute.of(context)?.settings.arguments
|
||||
as Map)['isAutomationDeviceStatus'] as bool;
|
||||
|
||||
/// static custom functions based on type
|
||||
/// used for now until later backend fixes
|
||||
@@ -38,6 +42,7 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
functions: device.functions,
|
||||
deviceId: device.uuid ?? '',
|
||||
deviceName: device.name ?? '',
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_man
|
||||
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
||||
import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_bloc.dart';
|
||||
import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_state.dart';
|
||||
import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_settings_route_arguments.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||
@@ -26,6 +28,10 @@ class SceneDevicesBody extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isAutomationDeviceStatus = (ModalRoute.of(context)?.settings.arguments
|
||||
as SceneSettingsRouteArguments)
|
||||
.sceneType ==
|
||||
CreateSceneEnum.deviceStatusChanges.name;
|
||||
return BlocBuilder<TabBarBloc, TabBarState>(
|
||||
builder: (context, tabState) {
|
||||
return Column(
|
||||
@@ -56,7 +62,10 @@ class SceneDevicesBody extends StatelessWidget {
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: rooms!.map((e) => _buildRoomTab(e, context)).toList(),
|
||||
children: rooms!
|
||||
.map((e) =>
|
||||
_buildRoomTab(e, context, isAutomationDeviceStatus))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -65,7 +74,8 @@ class SceneDevicesBody extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRoomTab(RoomModel room, BuildContext context) {
|
||||
Widget _buildRoomTab(
|
||||
RoomModel room, BuildContext context, bool isAutomationDeviceStatus) {
|
||||
return BlocBuilder<DeviceManagerBloc, DeviceManagerState>(
|
||||
builder: (context, state) {
|
||||
if (state.loading && state.devices == null) {
|
||||
@@ -96,7 +106,10 @@ class SceneDevicesBody extends StatelessWidget {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.deviceFunctionsRoute,
|
||||
arguments: device,
|
||||
arguments: {
|
||||
"device": device,
|
||||
"isAutomationDeviceStatus": isAutomationDeviceStatus
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user