Implement Flush Mounted Presence Sensor Routine Control and change the device type logic

This commit is contained in:
mohammad
2025-05-11 16:33:11 +03:00
parent 2651de71e4
commit adb42f95e8
26 changed files with 1071 additions and 180 deletions

View File

@ -7,12 +7,12 @@ import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class AlertDialogSliderSteps extends StatefulWidget {
const AlertDialogSliderSteps({
super.key,
this.functionValue,
required this.taskItem,
required this.isAutomation,
});
const AlertDialogSliderSteps(
{super.key,
this.functionValue,
required this.taskItem,
required this.isAutomation,
});
final dynamic functionValue;
final SceneStaticFunction taskItem;
@ -108,67 +108,69 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ToggleButtons(
isSelected: [
selectedToggleIndex == 0,
selectedToggleIndex == 1,
selectedToggleIndex == 2
],
onPressed: (index) {
setState(() {
selectedToggleIndex = index;
});
context.read<CreateSceneBloc>().add(
SelectedValueEvent(
value: _deNormalizeValue(groupValue),
code: widget.taskItem.code,
isAutomation: widget.isAutomation,
comparator: _indexToComparator(selectedToggleIndex),
widget.isAutomation
? ToggleButtons(
isSelected: [
selectedToggleIndex == 0,
selectedToggleIndex == 1,
selectedToggleIndex == 2
],
onPressed: (index) {
setState(() {
selectedToggleIndex = index;
});
context.read<CreateSceneBloc>().add(
SelectedValueEvent(
value: _deNormalizeValue(groupValue),
code: widget.taskItem.code,
isAutomation: widget.isAutomation,
comparator: _indexToComparator(selectedToggleIndex),
),
);
},
borderRadius: BorderRadius.circular(30),
selectedColor: Colors.white,
color: ColorsManager.blackColor,
fillColor: ColorsManager.primaryColorWithOpacity,
borderColor: ColorsManager.greyColor,
constraints: BoxConstraints.tight(const Size(70, 30)),
children: [
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 0
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text("<"),
),
),
);
},
borderRadius: BorderRadius.circular(30),
selectedColor: Colors.white,
color: ColorsManager.blackColor,
fillColor: ColorsManager.primaryColorWithOpacity,
borderColor: ColorsManager.greyColor,
constraints: BoxConstraints.tight(const Size(70, 30)),
children: [
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 0
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text("<"),
),
),
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 1
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text("="),
),
),
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 2
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text(">"),
),
),
],
),
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 1
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text("="),
),
),
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 2
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text(">"),
),
),
],
)
: SizedBox(),
const SizedBox(height: 12),
...widget.taskItem.operationalValues.map(
(operation) => BlocBuilder<CreateSceneBloc, CreateSceneState>(