diff --git a/assets/icons/presence-sensor-assets/Sensitivity.svg b/assets/icons/presence-sensor-assets/Sensitivity.svg
new file mode 100644
index 0000000..bac78f7
--- /dev/null
+++ b/assets/icons/presence-sensor-assets/Sensitivity.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/icons/presence-sensor-assets/maximum_distance.svg b/assets/icons/presence-sensor-assets/maximum_distance.svg
new file mode 100644
index 0000000..9b0faa1
--- /dev/null
+++ b/assets/icons/presence-sensor-assets/maximum_distance.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/icons/presence-sensor-assets/space_type_icon.svg b/assets/icons/presence-sensor-assets/space_type_icon.svg
new file mode 100644
index 0000000..198948f
--- /dev/null
+++ b/assets/icons/presence-sensor-assets/space_type_icon.svg
@@ -0,0 +1,10 @@
+
diff --git a/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart b/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart
index fd2aabc..5b2db52 100644
--- a/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart
+++ b/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart
@@ -1,7 +1,5 @@
-import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_bloc.dart';
@@ -9,6 +7,8 @@ import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_ev
import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_state.dart';
import 'package:syncrow_app/features/devices/model/ceiling_sensor_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/wall_sensor/wall_sensor_interface.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_medium.dart';
@@ -20,8 +20,6 @@ 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/font_manager.dart';
-import '../device_appbar.dart';
-
class CeilingSensorInterface extends StatelessWidget {
const CeilingSensorInterface({super.key, required this.ceilingSensor});
final DeviceModel ceilingSensor;
@@ -51,12 +49,10 @@ class CeilingSensorInterface extends StatelessWidget {
backgroundColor: ColorsManager.backgroundColor,
extendBodyBehindAppBar: true,
extendBody: true,
- appBar:DeviceAppbar(
+ appBar: DeviceAppbar(
deviceName: ceilingSensor.name!,
deviceUuid: ceilingSensor.uuid!,
),
-
-
body: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
@@ -77,85 +73,85 @@ class CeilingSensorInterface extends StatelessWidget {
: SafeArea(
child: Column(
children: [
- const Spacer(),
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- // InkWell(
- // onTap: () {
- // if ((ceilingSensor.isOnline ?? false) == false) {
- // ScaffoldMessenger.of(context).showSnackBar(
- // const SnackBar(
- // content: Text(
- // 'Device is offline',
- // ),
- // backgroundColor: Colors.red,
- // ),
- // );
- // return;
- // }
- // String controlCode = 'sensitivity';
- // showDialog(
- // context: context,
- // builder: (context) => ParameterControlDialog(
- // title: 'Sensitivity',
- // sensor: ceilingSensor,
- // controlCode: controlCode,
- // value: ceilingSensor.status
- // .firstWhere((element) => element.code == controlCode)
- // .value as int,
- // min: ceilingSensor.functions
- // .firstWhere((element) => element.code == controlCode)
- // .values
- // ?.min ??
- // 0,
- // max: ceilingSensor.functions
- // .firstWhere((element) => element.code == controlCode)
- // .values
- // ?.max ??
- // 0,
- // ),
- // );
- // },
- // child:
- // ),
-
- SvgPicture.asset(
- ceilingSensorModel.presenceState.toLowerCase() == 'motion'
- ? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion
- : Assets.assetsIconsPresenceSensorAssetsPresence,
- width: 100,
- height: 100,
- // colorFilter: ColorFilter.mode(
- // (ceilingSensor.isOnline ?? false)
- // ? ColorsManager.primaryColor
- // : Colors.grey.withOpacity(0.9),
- // BlendMode.srcIn,
- // ),
- ),
- const SizedBox(
- height: 10,
- ),
- BodyMedium(
- text: StringHelpers.toTitleCase(ceilingSensorModel.presenceState),
- // (ceilingSensor.isOnline ?? false)
- // ? StringHelpers.toTitleCase(ceilingSensor.status
- // .firstWhere((element) =>
- // element.code == 'presence_state')
- // .value
- // .toString())
- // : "Offline",
- style: context.bodyMedium.copyWith(
- fontWeight: FontsManager.bold,
- ),
- ),
- ],
- ),
- const Spacer(),
- SingleChildScrollView(
+ Expanded(
+ flex: 1,
child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisSize: MainAxisSize.min,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ // InkWell(
+ // onTap: () {
+ // if ((ceilingSensor.isOnline ?? false) == false) {
+ // ScaffoldMessenger.of(context).showSnackBar(
+ // const SnackBar(
+ // content: Text(
+ // 'Device is offline',
+ // ),
+ // backgroundColor: Colors.red,
+ // ),
+ // );
+ // return;
+ // }
+ // String controlCode = 'sensitivity';
+ // showDialog(
+ // context: context,
+ // builder: (context) => ParameterControlDialog(
+ // title: 'Sensitivity',
+ // sensor: ceilingSensor,
+ // controlCode: controlCode,
+ // value: ceilingSensor.status
+ // .firstWhere((element) => element.code == controlCode)
+ // .value as int,
+ // min: ceilingSensor.functions
+ // .firstWhere((element) => element.code == controlCode)
+ // .values
+ // ?.min ??
+ // 0,
+ // max: ceilingSensor.functions
+ // .firstWhere((element) => element.code == controlCode)
+ // .values
+ // ?.max ??
+ // 0,
+ // ),
+ // );
+ // },
+ // child:
+ // ),
+ SvgPicture.asset(
+ ceilingSensorModel.presenceState.toLowerCase() == 'motion'
+ ? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion
+ : Assets.assetsIconsPresenceSensorAssetsPresence,
+ width: 100,
+ height: 100,
+ // colorFilter: ColorFilter.mode(
+ // (ceilingSensor.isOnline ?? false)
+ // ? ColorsManager.primaryColor
+ // : Colors.grey.withOpacity(0.9),
+ // BlendMode.srcIn,
+ // ),
+ ),
+ const SizedBox(
+ height: 10,
+ ),
+ BodyMedium(
+ text:
+ StringHelpers.toTitleCase(ceilingSensorModel.presenceState),
+ // (ceilingSensor.isOnline ?? false)
+ // ? StringHelpers.toTitleCase(ceilingSensor.status
+ // .firstWhere((element) =>
+ // element.code == 'presence_state')
+ // .value
+ // .toString())
+ // : "Offline",
+ style: context.bodyMedium.copyWith(
+ fontWeight: FontsManager.bold,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ flex: 2,
+ child: ListView(
children: [
DefaultContainer(
padding: const EdgeInsets.symmetric(
@@ -238,38 +234,82 @@ class CeilingSensorInterface extends StatelessWidget {
height: 15,
),
...List.generate(
- ceilingSensorButtons.length,
+ ceilingSensorButtons().length,
(index) => DefaultContainer(
margin: const EdgeInsets.only(bottom: 5),
padding:
const EdgeInsets.symmetric(vertical: 12, horizontal: 20),
- onTap: () {
- if (ceilingSensorButtons[index]['page'] != null) {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- ceilingSensorButtons[index]['page'] as Widget,
- ),
+ onTap: () async {
+ if (ceilingSensorButtons()[index]['title'] ==
+ 'Sensitivity') {
+ final result = await showDialog(
+ context: context,
+ builder: (context) {
+ return ParameterControlDialog(
+ title: ceilingSensorButtons()[index]['title']
+ .toString(),
+ sensor: ceilingSensor,
+ value: ceilingSensorModel.sensitivity,
+ min: 0,
+ max: 10,
+ );
+ },
);
+ if (result != null) {
+ BlocProvider.of(context).add(
+ ChangeValueEvent(
+ value: result, code: 'sensitivity'));
+ }
}
+
+ // if (ceilingSensorButtons[index]['page'] != null) {
+ // Navigator.push(
+ // context,
+ // MaterialPageRoute(
+ // builder: (context) =>
+ // ceilingSensorButtons[index]['page'] as Widget,
+ // ),
+ // );
+ // }
},
child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- SvgPicture.asset(
- ceilingSensorButtons[index]['icon'] as String,
- // width: 30,
- // height: 50,
+ Row(
+ children: [
+ SvgPicture.asset(
+ ceilingSensorButtons()[index]['icon'] as String,
+ // width: 30,
+ // height: 50,
+ ),
+ const SizedBox(
+ width: 25,
+ ),
+ BodyMedium(
+ text: ceilingSensorButtons()[index]['title']
+ as String,
+ style: context.bodyMedium.copyWith(
+ fontWeight: FontsManager.bold,
+ ),
+ ),
+ ],
),
- const SizedBox(
- width: 25,
- ),
- BodyMedium(
- text: ceilingSensorButtons[index]['title'] as String,
- style: context.bodyMedium.copyWith(
- fontWeight: FontsManager.bold,
+ if (ceilingSensorButtons()[index]['withArrow'] == true)
+ Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ Text(ceilingSensorButtons(
+ sensitivity_val: ceilingSensorModel
+ .sensitivity
+ .toString())[index]['val']
+ .toString()),
+ const Icon(
+ Icons.arrow_forward_ios,
+ color: ColorsManager.greyColor,
+ size: 15,
+ ),
+ ],
),
- ),
],
),
),
@@ -285,22 +325,53 @@ class CeilingSensorInterface extends StatelessWidget {
}),
);
}
-}
-var ceilingSensorButtons = [
- {
- 'title': 'Parameter Settings',
- 'icon': Assets.assetsIconsPresenceSensorAssetsParameterSettings,
- 'page': null,
- },
- {
- 'title': 'Induction History',
- 'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
- 'page': null,
- },
- {
- 'title': 'Help Description',
- 'icon': Assets.assetsIconsPresenceSensorAssetsHelpDescription,
- 'page': null,
- },
-];
+ dynamic ceilingSensorButtons({
+ sensitivity_val = 0,
+ spaceType = 'Office',
+ maximumDistanceVal = '3.9m',
+ nobodyTimeVal = '1hr',
+ }) =>
+ [
+ {
+ 'title': 'Space Type',
+ 'icon': Assets.spaceTypeIcon,
+ 'page': null,
+ 'withArrow': true,
+ 'val': spaceType
+ },
+ {
+ 'title': 'Sensitivity',
+ 'icon': Assets.sensitivityIcon,
+ 'page': null,
+ 'withArrow': true,
+ 'val': sensitivity_val
+ },
+ {
+ 'title': 'Maximum Distance',
+ 'icon': Assets.maximumDistanceIcon,
+ 'page': null,
+ 'withArrow': true,
+ 'val': maximumDistanceVal,
+ },
+ {
+ 'title': 'Nobody Time',
+ 'icon': Assets.assetsIconsPresenceSensorAssetsEmpty,
+ 'page': null,
+ 'withArrow': true,
+ 'val': nobodyTimeVal,
+ },
+ {
+ 'title': 'Induction History',
+ 'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
+ 'page': null,
+ 'withArrow': false,
+ },
+ {
+ 'title': 'Help Description',
+ 'icon': Assets.assetsIconsPresenceSensorAssetsHelpDescription,
+ 'page': null,
+ 'withArrow': false,
+ },
+ ];
+}
diff --git a/lib/features/devices/view/widgets/ceiling_sensor/parameter_control_dialog.dart b/lib/features/devices/view/widgets/ceiling_sensor/parameter_control_dialog.dart
index 28c9183..d9f011e 100644
--- a/lib/features/devices/view/widgets/ceiling_sensor/parameter_control_dialog.dart
+++ b/lib/features/devices/view/widgets/ceiling_sensor/parameter_control_dialog.dart
@@ -6,7 +6,6 @@ class ParameterControlDialog extends StatefulWidget {
final int value;
final int min;
final int max;
- final String controlCode;
const ParameterControlDialog({
super.key,
@@ -15,7 +14,6 @@ class ParameterControlDialog extends StatefulWidget {
required this.value,
required this.min,
required this.max,
- required this.controlCode,
});
@override
diff --git a/lib/features/devices/view/widgets/wall_sensor/parameters_list.dart b/lib/features/devices/view/widgets/wall_sensor/parameters_list.dart
index 218a111..4b4dc20 100644
--- a/lib/features/devices/view/widgets/wall_sensor/parameters_list.dart
+++ b/lib/features/devices/view/widgets/wall_sensor/parameters_list.dart
@@ -12,7 +12,7 @@ class ParametersList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Expanded(
- flex: 7,
+ flex: 2,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -40,7 +40,6 @@ class ParametersList extends StatelessWidget {
builder: (context) => ParameterControlDialog(
title: 'Motion Detection Sensitivity',
sensor: wallSensor,
- controlCode: controlCode,
value: presenceSensorsModel.motionSensitivity,
min: wallSensor.functions
.firstWhere((element) => element.code == controlCode)
@@ -54,6 +53,7 @@ class ParametersList extends StatelessWidget {
0,
),
);
+ print('result=== $result');
if (result != null) {
BlocProvider.of(context)
.add(ChangeValueEvent(value: result, code: controlCode));
@@ -92,7 +92,6 @@ class ParametersList extends StatelessWidget {
builder: (context) => ParameterControlDialog(
title: 'Motionless Detection Sensitivity',
sensor: wallSensor,
- controlCode: controlCode,
value: presenceSensorsModel.motionlessSensitivity,
min: wallSensor.functions
.firstWhere((element) => element.code == controlCode)
@@ -141,13 +140,13 @@ class ParametersList extends StatelessWidget {
if ((wallSensor.isOnline ?? false) == false) {
return;
}
+
String controlCode = 'far_detection';
final result = await showDialog(
context: context,
builder: (context) => ParameterControlDialog(
title: 'Far Detection',
sensor: wallSensor,
- controlCode: controlCode,
value: presenceSensorsModel.farDetection,
min: wallSensor.functions
.firstWhere((element) => element.code == controlCode)
diff --git a/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart b/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart
index 36e02c5..74ebf83 100644
--- a/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart
+++ b/lib/features/devices/view/widgets/wall_sensor/presence_indicator.dart
@@ -10,7 +10,7 @@ class PresenceIndicator extends StatelessWidget {
// .value
// .toString();
return Expanded(
- flex: 6,
+ flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
diff --git a/lib/generated/assets.dart b/lib/generated/assets.dart
index 7cb7b59..d39855d 100644
--- a/lib/generated/assets.dart
+++ b/lib/generated/assets.dart
@@ -539,6 +539,19 @@ class Assets {
static const String assetsIconsPresenceSensorAssetsParameterSettings =
"assets/icons/presence-sensor-assets/parameter-settings.svg";
+ /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
+ /// assets/icons/presence-sensor-assets/space_type_icon.svg
+ static const String spaceTypeIcon = "assets/icons/presence-sensor-assets/space_type_icon.svg";
+
+ /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
+ /// assets/icons/presence-sensor-assets/space_type_icon.svg
+ static const String sensitivityIcon = "assets/icons/presence-sensor-assets/Sensitivity.svg";
+
+ /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
+ /// assets/icons/presence-sensor-assets/maximum_distance.svg
+ static const String maximumDistanceIcon =
+ "assets/icons/presence-sensor-assets/maximum_distance.svg";
+
/// Assets for assetsIconsPresenceSensorAssetsPresence
/// assets/icons/presence-sensor-assets/Presence.svg
static const String assetsIconsPresenceSensorAssetsPresence =