diff --git a/analysis_options.yaml b/analysis_options.yaml
index 0d290213..2e349a87 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -7,6 +7,9 @@
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
+analyzer:
+ errors:
+ constant_identifier_names: ignore
include: package:flutter_lints/flutter.yaml
linter:
diff --git a/assets/functions_icons/ac_cooling.svg b/assets/functions_icons/ac_cooling.svg
new file mode 100644
index 00000000..e95c0d4e
--- /dev/null
+++ b/assets/functions_icons/ac_cooling.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/ac_fan_auto.svg b/assets/functions_icons/ac_fan_auto.svg
new file mode 100644
index 00000000..0acacfef
--- /dev/null
+++ b/assets/functions_icons/ac_fan_auto.svg
@@ -0,0 +1,9 @@
+
diff --git a/assets/functions_icons/ac_fan_high.svg b/assets/functions_icons/ac_fan_high.svg
new file mode 100644
index 00000000..d6131531
--- /dev/null
+++ b/assets/functions_icons/ac_fan_high.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/ac_fan_low.svg b/assets/functions_icons/ac_fan_low.svg
new file mode 100644
index 00000000..f4bf56b7
--- /dev/null
+++ b/assets/functions_icons/ac_fan_low.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/ac_fan_middle.svg b/assets/functions_icons/ac_fan_middle.svg
new file mode 100644
index 00000000..ee940238
--- /dev/null
+++ b/assets/functions_icons/ac_fan_middle.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/ac_heating.svg b/assets/functions_icons/ac_heating.svg
new file mode 100644
index 00000000..47a160c8
--- /dev/null
+++ b/assets/functions_icons/ac_heating.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/functions_icons/ac_power.svg b/assets/functions_icons/ac_power.svg
new file mode 100644
index 00000000..cc2127f0
--- /dev/null
+++ b/assets/functions_icons/ac_power.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/functions_icons/ac_power_off.svg b/assets/functions_icons/ac_power_off.svg
new file mode 100644
index 00000000..70f7f9aa
--- /dev/null
+++ b/assets/functions_icons/ac_power_off.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/functions_icons/automation_functions/card_unlock.svg b/assets/functions_icons/automation_functions/card_unlock.svg
new file mode 100644
index 00000000..dd77680a
--- /dev/null
+++ b/assets/functions_icons/automation_functions/card_unlock.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/functions_icons/automation_functions/current_temp.svg b/assets/functions_icons/automation_functions/current_temp.svg
new file mode 100644
index 00000000..42cceb23
--- /dev/null
+++ b/assets/functions_icons/automation_functions/current_temp.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/functions_icons/automation_functions/doorbell.svg b/assets/functions_icons/automation_functions/doorbell.svg
new file mode 100644
index 00000000..1dc515a9
--- /dev/null
+++ b/assets/functions_icons/automation_functions/doorbell.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/functions_icons/automation_functions/doorlock_normal_open.svg b/assets/functions_icons/automation_functions/doorlock_normal_open.svg
new file mode 100644
index 00000000..8f4a5901
--- /dev/null
+++ b/assets/functions_icons/automation_functions/doorlock_normal_open.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/automation_functions/double_lock.svg b/assets/functions_icons/automation_functions/double_lock.svg
new file mode 100644
index 00000000..d8ad971d
--- /dev/null
+++ b/assets/functions_icons/automation_functions/double_lock.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/automation_functions/fingerprint_unlock.svg b/assets/functions_icons/automation_functions/fingerprint_unlock.svg
new file mode 100644
index 00000000..f9f5b84c
--- /dev/null
+++ b/assets/functions_icons/automation_functions/fingerprint_unlock.svg
@@ -0,0 +1,79 @@
+
diff --git a/assets/functions_icons/automation_functions/hijack_alarm.svg b/assets/functions_icons/automation_functions/hijack_alarm.svg
new file mode 100644
index 00000000..e32997fb
--- /dev/null
+++ b/assets/functions_icons/automation_functions/hijack_alarm.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/functions_icons/automation_functions/lock_alarm.svg b/assets/functions_icons/automation_functions/lock_alarm.svg
new file mode 100644
index 00000000..8bd2deeb
--- /dev/null
+++ b/assets/functions_icons/automation_functions/lock_alarm.svg
@@ -0,0 +1,149 @@
+
diff --git a/assets/functions_icons/automation_functions/motion.svg b/assets/functions_icons/automation_functions/motion.svg
new file mode 100644
index 00000000..8d69463b
--- /dev/null
+++ b/assets/functions_icons/automation_functions/motion.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/functions_icons/automation_functions/password_unlock.svg b/assets/functions_icons/automation_functions/password_unlock.svg
new file mode 100644
index 00000000..1920b69f
--- /dev/null
+++ b/assets/functions_icons/automation_functions/password_unlock.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/functions_icons/automation_functions/presence.svg b/assets/functions_icons/automation_functions/presence.svg
new file mode 100644
index 00000000..d71a474d
--- /dev/null
+++ b/assets/functions_icons/automation_functions/presence.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/functions_icons/automation_functions/presence_state.svg b/assets/functions_icons/automation_functions/presence_state.svg
new file mode 100644
index 00000000..d5de48e1
--- /dev/null
+++ b/assets/functions_icons/automation_functions/presence_state.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/functions_icons/automation_functions/remote_unlock_req.svg b/assets/functions_icons/automation_functions/remote_unlock_req.svg
new file mode 100644
index 00000000..da128ff7
--- /dev/null
+++ b/assets/functions_icons/automation_functions/remote_unlock_req.svg
@@ -0,0 +1,15 @@
+
diff --git a/assets/functions_icons/automation_functions/remote_unlock_via_app.svg b/assets/functions_icons/automation_functions/remote_unlock_via_app.svg
new file mode 100644
index 00000000..39fc859b
--- /dev/null
+++ b/assets/functions_icons/automation_functions/remote_unlock_via_app.svg
@@ -0,0 +1,40 @@
+
diff --git a/assets/functions_icons/automation_functions/residual_electricity.svg b/assets/functions_icons/automation_functions/residual_electricity.svg
new file mode 100644
index 00000000..6a5b6127
--- /dev/null
+++ b/assets/functions_icons/automation_functions/residual_electricity.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/functions_icons/automation_functions/self_test_result.svg b/assets/functions_icons/automation_functions/self_test_result.svg
new file mode 100644
index 00000000..8739327b
--- /dev/null
+++ b/assets/functions_icons/automation_functions/self_test_result.svg
@@ -0,0 +1,23 @@
+
diff --git a/assets/functions_icons/automation_functions/temp_password_unlock.svg b/assets/functions_icons/automation_functions/temp_password_unlock.svg
new file mode 100644
index 00000000..98d7573c
--- /dev/null
+++ b/assets/functions_icons/automation_functions/temp_password_unlock.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/functions_icons/celsius_degrees.svg b/assets/functions_icons/celsius_degrees.svg
new file mode 100644
index 00000000..7acbd6e7
--- /dev/null
+++ b/assets/functions_icons/celsius_degrees.svg
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/assets/functions_icons/child_lock.svg b/assets/functions_icons/child_lock.svg
new file mode 100644
index 00000000..6b0138bf
--- /dev/null
+++ b/assets/functions_icons/child_lock.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/functions_icons/factory_reset.svg b/assets/functions_icons/factory_reset.svg
new file mode 100644
index 00000000..7a47f24b
--- /dev/null
+++ b/assets/functions_icons/factory_reset.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/functions_icons/fan_speed.svg b/assets/functions_icons/fan_speed.svg
new file mode 100644
index 00000000..07a48834
--- /dev/null
+++ b/assets/functions_icons/fan_speed.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/far_detection.svg b/assets/functions_icons/far_detection.svg
new file mode 100644
index 00000000..2827d94a
--- /dev/null
+++ b/assets/functions_icons/far_detection.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/functions_icons/far_detection_function.svg b/assets/functions_icons/far_detection_function.svg
new file mode 100644
index 00000000..894b84ed
--- /dev/null
+++ b/assets/functions_icons/far_detection_function.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/functions_icons/freezing.svg b/assets/functions_icons/freezing.svg
new file mode 100644
index 00000000..6c02f2e4
--- /dev/null
+++ b/assets/functions_icons/freezing.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/functions_icons/indicator.svg b/assets/functions_icons/indicator.svg
new file mode 100644
index 00000000..b58a976e
--- /dev/null
+++ b/assets/functions_icons/indicator.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/light_countdown.svg b/assets/functions_icons/light_countdown.svg
new file mode 100644
index 00000000..94f65b9a
--- /dev/null
+++ b/assets/functions_icons/light_countdown.svg
@@ -0,0 +1,42 @@
+
diff --git a/assets/functions_icons/light_pulb.svg b/assets/functions_icons/light_pulb.svg
new file mode 100644
index 00000000..c442fdaf
--- /dev/null
+++ b/assets/functions_icons/light_pulb.svg
@@ -0,0 +1,37 @@
+
diff --git a/assets/functions_icons/master_state.svg b/assets/functions_icons/master_state.svg
new file mode 100644
index 00000000..0aafae1a
--- /dev/null
+++ b/assets/functions_icons/master_state.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/functions_icons/motion_detection.svg b/assets/functions_icons/motion_detection.svg
new file mode 100644
index 00000000..a9b2d685
--- /dev/null
+++ b/assets/functions_icons/motion_detection.svg
@@ -0,0 +1,21 @@
+
diff --git a/assets/functions_icons/motionless_detection.svg b/assets/functions_icons/motionless_detection.svg
new file mode 100644
index 00000000..25a767c1
--- /dev/null
+++ b/assets/functions_icons/motionless_detection.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/functions_icons/nobody_time.svg b/assets/functions_icons/nobody_time.svg
new file mode 100644
index 00000000..df80b517
--- /dev/null
+++ b/assets/functions_icons/nobody_time.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Distance.svg b/assets/functions_icons/presence-sensor-assets/Distance.svg
new file mode 100644
index 00000000..50578147
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Distance.svg
@@ -0,0 +1,20 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Empty.svg b/assets/functions_icons/presence-sensor-assets/Empty.svg
new file mode 100644
index 00000000..cf1e5df5
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Empty.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Illuminance-Record.svg b/assets/functions_icons/presence-sensor-assets/Illuminance-Record.svg
new file mode 100644
index 00000000..5f642436
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Illuminance-Record.svg
@@ -0,0 +1,21 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Illuminance-Value.svg b/assets/functions_icons/presence-sensor-assets/Illuminance-Value.svg
new file mode 100644
index 00000000..c087b7cd
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Illuminance-Value.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Indicator.svg b/assets/functions_icons/presence-sensor-assets/Indicator.svg
new file mode 100644
index 00000000..600d6da4
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Indicator.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Presence.svg b/assets/functions_icons/presence-sensor-assets/Presence.svg
new file mode 100644
index 00000000..638cb391
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Presence.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Record.svg b/assets/functions_icons/presence-sensor-assets/Record.svg
new file mode 100644
index 00000000..ff39c7ff
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Record.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Sensitivity.svg b/assets/functions_icons/presence-sensor-assets/Sensitivity.svg
new file mode 100644
index 00000000..bac78f75
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Sensitivity.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/Time.svg b/assets/functions_icons/presence-sensor-assets/Time.svg
new file mode 100644
index 00000000..f5b43adb
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/Time.svg
@@ -0,0 +1,29 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/help-description.svg b/assets/functions_icons/presence-sensor-assets/help-description.svg
new file mode 100644
index 00000000..1dd6f197
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/help-description.svg
@@ -0,0 +1,16 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/induction-recording.svg b/assets/functions_icons/presence-sensor-assets/induction-recording.svg
new file mode 100644
index 00000000..97e2c460
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/induction-recording.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/maximum_distance.svg b/assets/functions_icons/presence-sensor-assets/maximum_distance.svg
new file mode 100644
index 00000000..9b0faa1c
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/maximum_distance.svg
@@ -0,0 +1,17 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/parameter-settings.svg b/assets/functions_icons/presence-sensor-assets/parameter-settings.svg
new file mode 100644
index 00000000..a9966354
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/parameter-settings.svg
@@ -0,0 +1,31 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/presence-sensor-motion.svg b/assets/functions_icons/presence-sensor-assets/presence-sensor-motion.svg
new file mode 100644
index 00000000..6d33deb7
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/presence-sensor-motion.svg
@@ -0,0 +1,31 @@
+
diff --git a/assets/functions_icons/presence-sensor-assets/space_type_icon.svg b/assets/functions_icons/presence-sensor-assets/space_type_icon.svg
new file mode 100644
index 00000000..198948f2
--- /dev/null
+++ b/assets/functions_icons/presence-sensor-assets/space_type_icon.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/functions_icons/reset_off.svg b/assets/functions_icons/reset_off.svg
new file mode 100644
index 00000000..eac88f2b
--- /dev/null
+++ b/assets/functions_icons/reset_off.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/functions_icons/scene_child_lock.svg b/assets/functions_icons/scene_child_lock.svg
new file mode 100644
index 00000000..7e56164a
--- /dev/null
+++ b/assets/functions_icons/scene_child_lock.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/scene_child_unlock.svg b/assets/functions_icons/scene_child_unlock.svg
new file mode 100644
index 00000000..4eafbdea
--- /dev/null
+++ b/assets/functions_icons/scene_child_unlock.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/functions_icons/scene_refresh.svg b/assets/functions_icons/scene_refresh.svg
new file mode 100644
index 00000000..c54ffb04
--- /dev/null
+++ b/assets/functions_icons/scene_refresh.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/functions_icons/sensitivity.svg b/assets/functions_icons/sensitivity.svg
new file mode 100644
index 00000000..b75ebd3e
--- /dev/null
+++ b/assets/functions_icons/sensitivity.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/functions_icons/sesitivity_operation_icon.svg b/assets/functions_icons/sesitivity_operation_icon.svg
new file mode 100644
index 00000000..612148c5
--- /dev/null
+++ b/assets/functions_icons/sesitivity_operation_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/functions_icons/switch_alarm_sound.svg b/assets/functions_icons/switch_alarm_sound.svg
new file mode 100644
index 00000000..db645338
--- /dev/null
+++ b/assets/functions_icons/switch_alarm_sound.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/functions_icons/tempreture.svg b/assets/functions_icons/tempreture.svg
new file mode 100644
index 00000000..448083a7
--- /dev/null
+++ b/assets/functions_icons/tempreture.svg
@@ -0,0 +1,11 @@
+
diff --git a/lib/pages/common/custom_table.dart b/lib/pages/common/custom_table.dart
index 63fdc28a..61094c6f 100644
--- a/lib/pages/common/custom_table.dart
+++ b/lib/pages/common/custom_table.dart
@@ -12,7 +12,7 @@ class DynamicTable extends StatefulWidget {
final bool withCheckBox;
final bool isEmpty;
final void Function(bool?)? selectAll;
- final void Function(int, bool?)? onRowCheckboxChanged;
+ final void Function(int, bool, dynamic)? onRowSelected;
final List? initialSelectedIds;
const DynamicTable({
@@ -25,7 +25,7 @@ class DynamicTable extends StatefulWidget {
this.headerDecoration,
this.cellDecoration,
this.selectAll,
- this.onRowCheckboxChanged,
+ this.onRowSelected,
this.initialSelectedIds,
});
@@ -35,7 +35,6 @@ class DynamicTable extends StatefulWidget {
class _DynamicTableState extends State {
late List _selected;
- bool _selectAll = false;
@override
void initState() {
@@ -44,25 +43,19 @@ class _DynamicTableState extends State {
return widget.initialSelectedIds != null &&
widget.initialSelectedIds!.contains(widget.data[index][1]);
});
- _selectAll = _selected.every((element) => element == true);
}
- void _toggleSelectAll(bool? value) {
+ void _toggleRowSelection(int index) {
setState(() {
- _selectAll = value ?? false;
- _selected = List.filled(widget.data.length, _selectAll);
- if (widget.selectAll != null) {
- widget.selectAll!(_selectAll);
+ // Deselect all rows
+ for (int i = 0; i < _selected.length; i++) {
+ _selected[i] = false;
}
- });
- }
+ // Select the clicked row
+ _selected[index] = true;
- void _toggleRowSelection(int index, bool? value) {
- setState(() {
- _selected[index] = value ?? false;
- _selectAll = _selected.every((element) => element == true);
- if (widget.onRowCheckboxChanged != null) {
- widget.onRowCheckboxChanged!(index, _selected[index]);
+ if (widget.onRowSelected != null) {
+ widget.onRowSelected!(index, true, widget.data[index]);
}
});
}
@@ -108,7 +101,7 @@ class _DynamicTableState extends State {
height: 15,
),
Text(
- 'No Passwords',
+ 'No Devices',
style: Theme.of(context)
.textTheme
.bodySmall!
@@ -157,81 +150,104 @@ class _DynamicTableState extends State {
Widget _buildSelectAllCheckbox() {
return Container(
+ width: 50, // Fixed width to align with the checkbox column
padding: const EdgeInsets.all(8.0),
decoration: const BoxDecoration(
- border: Border.symmetric(
- vertical: BorderSide(color: ColorsManager.boxDivider))),
+ border: Border.symmetric(
+ vertical: BorderSide(color: ColorsManager.boxDivider),
+ ),
+ ),
child: Checkbox(
- value: _selectAll,
- onChanged: _toggleSelectAll,
+ value: _selected.every((element) => element == true),
+ onChanged: null, // Disabling the toggle as we're not using select all
),
);
}
- Widget _buildRowCheckbox(int index, size) {
+ Widget _buildRowCheckbox(int index, double size) {
return Container(
- padding: const EdgeInsets.all(8.0),
- height: size,
- decoration: const BoxDecoration(
- border: Border(
+ width: 50, // Fixed width to align with the checkbox column
+ padding: const EdgeInsets.all(8.0),
+ height: size,
+ decoration: const BoxDecoration(
+ border: Border(
bottom: BorderSide(
color: ColorsManager.boxDivider,
width: 1.0,
),
- )),
- alignment: Alignment.centerLeft,
- child: Center(
- child: Checkbox(
- value: _selected[index],
- onChanged: (bool? value) {
- _toggleRowSelection(index, value);
- },
- ),
- ));
+ ),
+ ),
+ alignment: Alignment.centerLeft,
+ child: Center(
+ child: Checkbox(
+ value: _selected[index],
+ onChanged: (bool? value) {
+ _toggleRowSelection(index);
+ },
+ ),
+ ),
+ );
}
Widget _buildTableHeaderCell(String title) {
return Expanded(
child: Container(
decoration: const BoxDecoration(
- border: Border.symmetric(
- vertical: BorderSide(color: ColorsManager.boxDivider))),
+ border: Border.symmetric(
+ vertical: BorderSide(color: ColorsManager.boxDivider),
+ ),
+ ),
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(8.0),
- child: Text(title,
- style: const TextStyle(
- fontWeight: FontWeight.w400,
- fontSize: 13,
- color: Color(0xFF999999))),
+ child: Text(
+ title,
+ style: const TextStyle(
+ fontWeight: FontWeight.w400,
+ fontSize: 13,
+ color: Color(0xFF999999),
+ ),
+ ),
),
),
);
}
- Widget _buildTableCell(String content, size) {
+ Widget _buildTableCell(String content, double size) {
+ // Check if the content is a battery level percentage
+ bool isBatteryLevel = content.endsWith('%');
+ double? batteryLevel;
+
+ if (isBatteryLevel) {
+ batteryLevel = double.tryParse(content.replaceAll('%', '').trim());
+ }
+
return Expanded(
child: Container(
height: size,
padding: const EdgeInsets.all(5.0),
decoration: const BoxDecoration(
- border: Border(
- bottom: BorderSide(
- color: ColorsManager.boxDivider,
- width: 1.0,
+ border: Border(
+ bottom: BorderSide(
+ color: ColorsManager.boxDivider,
+ width: 1.0,
+ ),
),
- )),
+ ),
alignment: Alignment.centerLeft,
child: Text(
content,
style: TextStyle(
- color: content == 'Online'
- ? ColorsManager.green
- : content == 'Offline'
- ? ColorsManager.red
- : Colors.black,
- fontSize: 12,
- fontWeight: FontWeight.w400),
+ color: batteryLevel != null && batteryLevel < 20
+ ? ColorsManager.red // Red color for low battery
+ : content == 'Online'
+ ? ColorsManager.green // Green color for Online
+ : content == 'Offline'
+ ? ColorsManager.red // Red color for Offline
+ : Colors.black,
+ fontSize: 12,
+ fontWeight: FontWeight.w400,
+ ),
),
),
);
diff --git a/lib/pages/device_managment/bloc/device_managment_bloc.dart b/lib/pages/device_managment/all_devices/bloc/device_managment_bloc.dart
similarity index 91%
rename from lib/pages/device_managment/bloc/device_managment_bloc.dart
rename to lib/pages/device_managment/all_devices/bloc/device_managment_bloc.dart
index edc6e7ba..8f9b9bc3 100644
--- a/lib/pages/device_managment/bloc/device_managment_bloc.dart
+++ b/lib/pages/device_managment/all_devices/bloc/device_managment_bloc.dart
@@ -1,6 +1,6 @@
import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
-import 'package:syncrow_web/pages/device_managment/models/devices_model.dart';
+import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
import 'package:syncrow_web/services/devices_mang_api.dart';
part 'device_managment_event.dart';
@@ -13,12 +13,14 @@ class DeviceManagementBloc
int _onlineCount = 0;
int _offlineCount = 0;
int _lowBatteryCount = 0;
+ AllDevicesModel? _selectedDevice;
DeviceManagementBloc() : super(DeviceManagementInitial()) {
on(_onFetchDevices);
on(_onFilterDevices);
on(_onSelectedFilterChanged);
on(_onSearchDevices);
+ on(_onSelectDevice);
}
Future _onFetchDevices(
@@ -71,6 +73,11 @@ class DeviceManagementBloc
add(FilterDevices(_getFilterFromIndex(_selectedIndex)));
}
+ void _onSelectDevice(
+ SelectDevice event, Emitter emit) {
+ _selectedDevice = event.selectedDevice;
+ }
+
void _calculateDeviceCounts() {
_onlineCount = _devices.where((device) => device.online == true).length;
_offlineCount = _devices.where((device) => device.online == false).length;
@@ -127,4 +134,6 @@ class DeviceManagementBloc
));
}
}
+
+ AllDevicesModel? get selectedDevice => _selectedDevice;
}
diff --git a/lib/pages/device_managment/bloc/device_managment_event.dart b/lib/pages/device_managment/all_devices/bloc/device_managment_event.dart
similarity index 82%
rename from lib/pages/device_managment/bloc/device_managment_event.dart
rename to lib/pages/device_managment/all_devices/bloc/device_managment_event.dart
index a03b2659..444f3406 100644
--- a/lib/pages/device_managment/bloc/device_managment_event.dart
+++ b/lib/pages/device_managment/all_devices/bloc/device_managment_event.dart
@@ -41,3 +41,12 @@ class SearchDevices extends DeviceManagementEvent {
@override
List