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/bloc/ceiling_bloc/ceiling_sensor_buttons.dart b/lib/features/devices/bloc/ceiling_bloc/ceiling_sensor_buttons.dart
new file mode 100644
index 0000000..c27dfb2
--- /dev/null
+++ b/lib/features/devices/bloc/ceiling_bloc/ceiling_sensor_buttons.dart
@@ -0,0 +1,60 @@
+
+
+
+import 'package:syncrow_app/generated/assets.dart';
+
+dynamic ceilingSensorButtons({
+ sensitivity_val = 0,
+ spaceType='Office',
+ maximumDistanceVal='3.9m',
+ nobodyTimeVal='1hr',
+}) => [
+ {
+ 'title': 'Space Type',
+ 'icon': Assets.space_type_icon,
+ 'page': null,
+ 'withArrow':true,
+ 'val':spaceType
+
+ },
+
+ {
+ 'title': 'Sensitivity',
+ 'icon': Assets.sensitivity,
+ 'page': null,
+ 'withArrow':true,
+ 'val':sensitivity_val
+
+ },
+ {
+ 'title': 'Maximum Distance',
+ 'icon': Assets.maximum_distance,
+ '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/ceiling_sensor_interface.dart b/lib/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart
index fd2aabc..adab1d5 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,3 +1,4 @@
+
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -5,9 +6,13 @@ 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';
+import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_buttons.dart';
import 'package:syncrow_app/features/devices/bloc/ceiling_bloc/ceiling_sensor_event.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/wall_sensor_bloc/wall_sensor_bloc.dart';
import 'package:syncrow_app/features/devices/model/ceiling_sensor_model.dart';
+import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
@@ -21,6 +26,7 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
import '../device_appbar.dart';
+import '../wall_sensor/wall_sensor_interface.dart';
class CeilingSensorInterface extends StatelessWidget {
const CeilingSensorInterface({super.key, required this.ceilingSensor});
@@ -35,8 +41,8 @@ class CeilingSensorInterface extends StatelessWidget {
create: (context) =>
CeilingSensorBloc(deviceId: ceilingSensor.uuid ?? '')..add(InitialEvent()),
child: BlocBuilder(builder: (context, state) {
- CeilingSensorModel ceilingSensorModel =
- CeilingSensorModel(presenceState: 'none', sensitivity: 1, checkingResult: '');
+
+ CeilingSensorModel ceilingSensorModel = CeilingSensorModel(presenceState: 'none', sensitivity: 1, checkingResult: '');
if (state is UpdateState) {
ceilingSensorModel = state.ceilingSensorModel;
} else if (state is LoadingNewSate) {
@@ -55,8 +61,6 @@ class CeilingSensorInterface extends StatelessWidget {
deviceName: ceilingSensor.name!,
deviceUuid: ceilingSensor.uuid!,
),
-
-
body: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
@@ -119,7 +123,6 @@ class CeilingSensorInterface extends StatelessWidget {
// },
// child:
// ),
-
SvgPicture.asset(
ceilingSensorModel.presenceState.toLowerCase() == 'motion'
? Assets.assetsIconsPresenceSensorAssetsPresenceSensorMotion
@@ -238,26 +241,46 @@ 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: [
+ Row(children: [
SvgPicture.asset(
- ceilingSensorButtons[index]['icon'] as String,
+ ceilingSensorButtons()[index]['icon'] as String,
// width: 30,
// height: 50,
),
@@ -265,11 +288,25 @@ class CeilingSensorInterface extends StatelessWidget {
width: 25,
),
BodyMedium(
- text: ceilingSensorButtons[index]['title'] as String,
+ 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,
+ ),
+ ],
+ ),
],
),
),
@@ -286,21 +323,3 @@ 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,
- },
-];
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..48981ee 100644
--- a/lib/features/devices/view/widgets/wall_sensor/parameters_list.dart
+++ b/lib/features/devices/view/widgets/wall_sensor/parameters_list.dart
@@ -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)
@@ -52,8 +51,10 @@ class ParametersList extends StatelessWidget {
.values
?.max ??
0,
+
),
);
+ print('result=== $result');
if (result != null) {
BlocProvider.of(context)
.add(ChangeValueEvent(value: result, code: controlCode));
@@ -92,7 +93,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 +141,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/generated/assets.dart b/lib/generated/assets.dart
index eae0990..1ac4100 100644
--- a/lib/generated/assets.dart
+++ b/lib/generated/assets.dart
@@ -538,6 +538,25 @@ 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 space_type_icon =
+ "assets/icons/presence-sensor-assets/space_type_icon.svg";
+
+
+ /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
+ /// assets/icons/presence-sensor-assets/space_type_icon.svg
+ static const String sensitivity =
+ "assets/icons/presence-sensor-assets/Sensitivity.svg";
+
+ /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
+ /// assets/icons/presence-sensor-assets/maximum_distance.svg
+ static const String maximum_distance =
+ "assets/icons/presence-sensor-assets/maximum_distance.svg";
+
+
/// Assets for assetsIconsPresenceSensorAssetsPresence
/// assets/icons/presence-sensor-assets/Presence.svg
static const String assetsIconsPresenceSensorAssetsPresence =
@@ -720,4 +739,7 @@ class Assets {
/// Assets for assetsImagesWindow
/// assets/images/Window.png
static const String assetsImagesWindow = "assets/images/Window.png";
+
+
+
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 0da1da4..68fd0f3 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -43,6 +43,7 @@ dependencies:
pin_code_fields: ^8.0.1
share_plus: ^9.0.0
+
dev_dependencies:
flutter_test:
sdk: flutter