formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions

View File

@ -24,8 +24,7 @@ class ACHelper {
required bool? removeComparetors,
required String dialogType,
}) async {
List<ACFunction> acFunctions =
functions.whereType<ACFunction>().where((function) {
final acFunctions = functions.whereType<ACFunction>().where((function) {
if (dialogType == 'THEN') {
return function.type == 'THEN' || function.type == 'BOTH';
}
@ -371,7 +370,7 @@ class ACHelper {
// return Container(
// padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
// decoration: BoxDecoration(
// color: ColorsManager.primaryColorWithOpacity.withOpacity(0.1),
// color: ColorsManager.primaryColorWithOpacity.withValues(alpha:0.1),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(

View File

@ -3,8 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart';
import 'package:syncrow_web/pages/routines/widgets/dialog_footer.dart';
import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
class AutomationDialog extends StatefulWidget {
@ -31,9 +31,11 @@ class _AutomationDialogState extends State<AutomationDialog> {
@override
void initState() {
super.initState();
List<DeviceFunctionData>? functions =
context.read<RoutineBloc>().state.selectedFunctions[widget.uniqueCustomId];
for (DeviceFunctionData data in functions ?? []) {
final functions = context
.read<RoutineBloc>()
.state
.selectedFunctions[widget.uniqueCustomId];
for (final data in functions ?? []) {
if (data.entityId == widget.automationId) {
selectedAutomationActionExecutor = data.value;
}
@ -65,7 +67,8 @@ class _AutomationDialogState extends State<AutomationDialog> {
}),
),
ListTile(
leading: SvgPicture.asset(Assets.acPowerOff, width: 24, height: 24),
leading:
SvgPicture.asset(Assets.acPowerOff, width: 24, height: 24),
title: const Text('Disable'),
trailing: Radio<String?>(
value: 'rule_disable',

View File

@ -45,7 +45,8 @@ class CpsDialogValueSelector extends StatelessWidget {
operationName: operationName,
value: operation.value,
condition: selectedFunctionData?.condition,
valueDescription: selectedFunctionData?.valueDescription,
valueDescription:
selectedFunctionData?.valueDescription,
),
),
);

View File

@ -57,7 +57,7 @@ class CpsFunctionsList extends StatelessWidget {
'moving_max_dis',
'moving_range',
'presence_range',
if (dialogType == "IF") 'sensitivity',
if (dialogType == 'IF') 'sensitivity',
],
);
});

View File

@ -1,5 +1,6 @@
abstract final class CpsSliderHelpers {
static (double min, double max, double step) mappedRange(String functionCode) {
static (double min, double max, double step) mappedRange(
String functionCode) {
final (defaultMin, defaultMax) = sliderRange(functionCode);
final defaultDivdidend = dividendOfRange(functionCode);
return switch (functionCode) {
@ -62,7 +63,10 @@ abstract final class CpsSliderHelpers {
'perceptual_boundary' ||
'moving_boundary' =>
'M',
'moving_rigger_time' || 'moving_static_time' || 'none_body_time' => 'sec',
'moving_rigger_time' ||
'moving_static_time' ||
'none_body_time' =>
'sec',
_ => '',
};

View File

@ -9,14 +9,14 @@ import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart';
class DelayHelper {
static Future<Map<String, dynamic>?> showDelayPickerDialog(
BuildContext context, Map<String, dynamic> data) async {
int hours = 0;
int minutes = 0;
var hours = 0;
var minutes = 0;
return showDialog<Map<String, dynamic>?>(
context: context,
builder: (BuildContext context) {
final routineBloc = context.read<RoutineBloc>();
int totalSec = 0;
var totalSec = 0;
final selectedFunctionData =
routineBloc.state.selectedFunctions[data['uniqueCustomId']] ?? [];
@ -43,7 +43,8 @@ class DelayHelper {
Expanded(
child: CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.hm,
initialTimerDuration: Duration(hours: hours, minutes: minutes),
initialTimerDuration:
Duration(hours: hours, minutes: minutes),
onTimerDurationChanged: (Duration newDuration) {
hours = newDuration.inHours;
minutes = newDuration.inMinutes % 60;
@ -55,7 +56,7 @@ class DelayHelper {
Navigator.of(context).pop();
},
onConfirm: () {
int totalSeconds = (hours * 3600) + (minutes * 60);
final totalSeconds = (hours * 3600) + (minutes * 60);
context.read<RoutineBloc>().add(AddFunctionToRoutine(
[
DeviceFunctionData(

View File

@ -38,10 +38,10 @@ class DiscardDialog {
color: ColorsManager.red,
fontWeight: FontWeight.bold,
),
onDismissText: "Dont Close",
onConfirmText: "Close",
onDismissText: 'Dont Close',
onConfirmText: 'Close',
onDismissColor: ColorsManager.grayColor,
onConfirmColor: ColorsManager.red.withOpacity(0.8),
onConfirmColor: ColorsManager.red.withValues(alpha: 0.8),
onDismiss: () {
Navigator.pop(context);
},

View File

@ -8,13 +8,14 @@ import 'package:syncrow_web/utils/extension/build_context_x.dart';
import 'package:time_picker_spinner/time_picker_spinner.dart';
class EffectPeriodHelper {
static Future<List<String>?> showCustomTimePicker(BuildContext context) async {
String selectedStartTime = "00:00";
String selectedEndTime = "23:59";
PageController pageController = PageController(initialPage: 0);
static Future<List<String>?> showCustomTimePicker(
BuildContext context) async {
var selectedStartTime = '00:00';
var selectedEndTime = '23:59';
final pageController = PageController(initialPage: 0);
DateTime startDateTime = DateTime(2022, 1, 1, 0, 0);
DateTime endDateTime = DateTime(2022, 1, 1, 23, 59);
final startDateTime = DateTime(2022, 1, 1, 0, 0);
final endDateTime = DateTime(2022, 1, 1, 23, 59);
context.customAlertDialog(
alertBody: SizedBox(
@ -46,7 +47,7 @@ class EffectPeriodHelper {
],
),
),
title: "Custom",
title: 'Custom',
onConfirm: () {
context.read<EffectPeriodBloc>().add(
SetCustomTime(selectedStartTime, selectedEndTime),
@ -88,7 +89,7 @@ class EffectPeriodHelper {
),
TextButton(
onPressed: () {},
child: Text(isStartTime ? "Start" : "End",
child: Text(isStartTime ? 'Start' : 'End',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
@ -135,17 +136,17 @@ class EffectPeriodHelper {
static String formatEnumValue(EnumEffectivePeriodOptions value) {
switch (value) {
case EnumEffectivePeriodOptions.allDay:
return "All Day";
return 'All Day';
case EnumEffectivePeriodOptions.daytime:
return "Daytime";
return 'Daytime';
case EnumEffectivePeriodOptions.night:
return "Night";
return 'Night';
case EnumEffectivePeriodOptions.custom:
return "Custom";
return 'Custom';
case EnumEffectivePeriodOptions.none:
return "None";
return 'None';
default:
return "";
return '';
}
}
}

View File

@ -7,7 +7,6 @@ import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/pages/routines/models/flush/flush_functions.dart';
import 'package:syncrow_web/pages/routines/widgets/custom_routines_textbox.dart';
import 'package:syncrow_web/pages/routines/widgets/routine_dialogs/flush_presence_sensor/flush_operational_values_list.dart';
import 'package:syncrow_web/pages/routines/widgets/slider_value_selector.dart';
class FlushValueSelectorWidget extends StatelessWidget {
final String selectedFunction;
@ -62,7 +61,7 @@ class FlushValueSelectorWidget extends StatelessWidget {
selectedFunction == FlushMountedPresenceSensorModel.codeFarDetection;
final isDistanceDetection = isNearDetection || isFarDetection;
double initialValue = (functionData.value as num?)?.toDouble() ?? 0.0;
var initialValue = (functionData.value as num?)?.toDouble() ?? 0.0;
if (isDistanceDetection) {
initialValue = initialValue / 100;
@ -157,7 +156,7 @@ class FlushValueSelectorWidget extends StatelessWidget {
String get getDisplayText {
final num? value = functionData.value;
double displayValue = value?.toDouble() ?? 0.0;
var displayValue = value?.toDouble() ?? 0.0;
if (functionData.functionCode ==
FlushMountedPresenceSensorModel.codeNearDetection ||

View File

@ -49,8 +49,6 @@ class _TimeWheelPickerState extends State<TimeWheelPicker> {
}
}
@override
void dispose() {
_hoursController.dispose();
@ -103,7 +101,7 @@ class _TimeWheelPickerState extends State<TimeWheelPicker> {
}
void _handleTimeChange(int hours, int minutes, int seconds) {
int total = hours * 3600 + minutes * 60 + seconds;
var total = hours * 3600 + minutes * 60 + seconds;
if (total > 10000) {
hours = 2;
minutes = 46;

View File

@ -45,7 +45,8 @@ class GatewayDialogValueSelector extends StatelessWidget {
operationName: operationName,
value: operation.value,
condition: selectedFunctionData?.condition,
valueDescription: selectedFunctionData?.valueDescription,
valueDescription:
selectedFunctionData?.valueDescription,
),
),
);

View File

@ -25,8 +25,7 @@ class OneGangSwitchHelper {
required String uniqueCustomId,
required bool removeComparetors,
}) async {
List<BaseSwitchFunction> oneGangFunctions =
functions.whereType<BaseSwitchFunction>().toList();
final oneGangFunctions = functions.whereType<BaseSwitchFunction>().toList();
return showDialog<Map<String, dynamic>?>(
context: context,
@ -246,9 +245,9 @@ class OneGangSwitchHelper {
withSpecialChar: false,
currentCondition: selectedFunctionData?.condition,
dialogType: dialogType,
sliderRange: (0, 43200),
sliderRange: (0, 43200),
displayedValue: (initialValue ?? 0).toString(),
initialValue: (initialValue ?? 0).toString(),
initialValue: (initialValue ?? 0).toString(),
onConditionChanged: (condition) {
context.read<FunctionBloc>().add(
AddFunction(

View File

@ -81,6 +81,4 @@ class EnergyOperationalValuesList extends StatelessWidget {
),
);
}
}

View File

@ -27,13 +27,11 @@ class EnergyValueSelectorWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final selectedFn =
functions.firstWhere((f) => f.code == selectedFunction);
final selectedFn = functions.firstWhere((f) => f.code == selectedFunction);
final values = selectedFn.getOperationalValues();
final step = selectedFn.step ?? 1.0;
final _unit = selectedFn.unit ?? '';
final (double, double) sliderRange =
(selectedFn.min ?? 0.0, selectedFn.max ?? 100.0);
final step = selectedFn.step ?? 1.0;
final unit = selectedFn.unit ?? '';
final sliderRange = (selectedFn.min ?? 0.0, selectedFn.max ?? 100.0);
if (_isSliderFunction(selectedFunction)) {
return CustomRoutinesTextbox(
@ -65,7 +63,7 @@ class EnergyValueSelectorWidget extends StatelessWidget {
),
),
),
unit: _unit,
unit: unit,
dividendOfRange: 1,
stepIncreaseAmount: step,
);

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/routines/bloc/effective_period/effect_period_bloc.dart';
@ -13,7 +14,6 @@ import 'package:syncrow_web/pages/routines/view/effective_period_view.dart';
import 'package:syncrow_web/pages/routines/widgets/delete_scene.dart';
import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:flutter/cupertino.dart';
class SettingHelper {
static Future<String?> showSettingDialog({
@ -30,14 +30,16 @@ class SettingHelper {
providers: [
if (effectiveTime != null)
BlocProvider(
create: (_) => EffectPeriodBloc()..add(InitialEffectPeriodEvent(effectiveTime)),
create: (_) => EffectPeriodBloc()
..add(InitialEffectPeriodEvent(effectiveTime)),
),
if (effectiveTime == null)
BlocProvider(
create: (_) => EffectPeriodBloc(),
),
BlocProvider(
create: (_) => SettingBloc()..add(InitialEvent(selectedIcon: iconId ?? ''))),
create: (_) => SettingBloc()
..add(InitialEvent(selectedIcon: iconId ?? ''))),
],
child: AlertDialog(
contentPadding: EdgeInsets.zero,
@ -45,15 +47,18 @@ class SettingHelper {
builder: (context, effectPeriodState) {
return BlocBuilder<SettingBloc, SettingState>(
builder: (context, settingState) {
String selectedIcon = '';
List<IconModel> list = [];
var selectedIcon = '';
var list = <IconModel>[];
if (settingState is TabToRunSettingLoaded) {
selectedIcon = settingState.selectedIcon;
list = settingState.iconList;
}
return Container(
width: context.read<SettingBloc>().isExpanded ? 800 : 400,
height: context.read<SettingBloc>().isExpanded && isAutomation ? 500 : 350,
height:
context.read<SettingBloc>().isExpanded && isAutomation
? 500
: 350,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
@ -76,14 +81,18 @@ class SettingHelper {
children: [
Container(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10),
top: 10,
left: 10,
right: 10,
bottom: 10),
child: Column(
children: [
InkWell(
onTap: () {},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Validity',
@ -91,14 +100,18 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color:
ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
color: ColorsManager
.textPrimaryColor,
fontWeight:
FontWeight
.w400,
fontSize: 14),
),
const Icon(
Icons.arrow_forward_ios_outlined,
color: ColorsManager.textGray,
Icons
.arrow_forward_ios_outlined,
color: ColorsManager
.textGray,
size: 15,
)
],
@ -108,22 +121,27 @@ class SettingHelper {
height: 5,
),
const Divider(
color: ColorsManager.graysColor,
color:
ColorsManager.graysColor,
),
const SizedBox(
height: 5,
),
InkWell(
onTap: () {
BlocProvider.of<SettingBloc>(context).add(
FetchIcons(
BlocProvider.of<
SettingBloc>(
context)
.add(FetchIcons(
expanded: !context
.read<SettingBloc>()
.read<
SettingBloc>()
.isExpanded));
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Effective Period',
@ -131,14 +149,18 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color:
ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
color: ColorsManager
.textPrimaryColor,
fontWeight:
FontWeight
.w400,
fontSize: 14),
),
const Icon(
Icons.arrow_forward_ios_outlined,
color: ColorsManager.textGray,
Icons
.arrow_forward_ios_outlined,
color: ColorsManager
.textGray,
size: 15,
)
],
@ -148,13 +170,16 @@ class SettingHelper {
height: 5,
),
const Divider(
color: ColorsManager.graysColor,
color:
ColorsManager.graysColor,
),
const SizedBox(
height: 5,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Executed by',
@ -162,8 +187,11 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
color: ColorsManager
.textPrimaryColor,
fontWeight:
FontWeight
.w400,
fontSize: 14),
),
Text('Cloud',
@ -171,12 +199,19 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager.textGray,
fontWeight: FontWeight.w400,
color:
ColorsManager
.textGray,
fontWeight:
FontWeight
.w400,
fontSize: 14)),
],
),
if (context.read<RoutineBloc>().state.isUpdate ??
if (context
.read<RoutineBloc>()
.state
.isUpdate ??
false)
const DeleteSceneWidget()
],
@ -188,20 +223,27 @@ class SettingHelper {
children: [
Container(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10),
top: 10,
left: 10,
right: 10,
bottom: 10),
child: Column(
children: [
InkWell(
onTap: () {
BlocProvider.of<SettingBloc>(context).add(
FetchIcons(
BlocProvider.of<
SettingBloc>(
context)
.add(FetchIcons(
expanded: !context
.read<SettingBloc>()
.read<
SettingBloc>()
.isExpanded));
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Icons',
@ -209,14 +251,18 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color:
ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
color: ColorsManager
.textPrimaryColor,
fontWeight:
FontWeight
.w400,
fontSize: 14),
),
const Icon(
Icons.arrow_forward_ios_outlined,
color: ColorsManager.textGray,
Icons
.arrow_forward_ios_outlined,
color: ColorsManager
.textGray,
size: 15,
)
],
@ -226,13 +272,16 @@ class SettingHelper {
height: 5,
),
const Divider(
color: ColorsManager.graysColor,
color:
ColorsManager.graysColor,
),
const SizedBox(
height: 5,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Show on devices page',
@ -240,23 +289,30 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
color: ColorsManager
.textPrimaryColor,
fontWeight:
FontWeight
.w400,
fontSize: 14),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Container(
height: 30,
width: 1,
color: ColorsManager.graysColor,
color: ColorsManager
.graysColor,
),
Transform.scale(
scale: .8,
child: CupertinoSwitch(
child:
CupertinoSwitch(
value: true,
onChanged: (value) {},
onChanged:
(value) {},
applyTheme: true,
),
),
@ -268,13 +324,16 @@ class SettingHelper {
height: 5,
),
const Divider(
color: ColorsManager.graysColor,
color:
ColorsManager.graysColor,
),
const SizedBox(
height: 5,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'Executed by',
@ -282,8 +341,11 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager.textPrimaryColor,
fontWeight: FontWeight.w400,
color: ColorsManager
.textPrimaryColor,
fontWeight:
FontWeight
.w400,
fontSize: 14),
),
Text('Cloud',
@ -291,12 +353,19 @@ class SettingHelper {
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager.textGray,
fontWeight: FontWeight.w400,
color:
ColorsManager
.textGray,
fontWeight:
FontWeight
.w400,
fontSize: 14)),
],
),
if (context.read<RoutineBloc>().state.isUpdate ??
if (context
.read<RoutineBloc>()
.state
.isUpdate ??
false)
const DeleteSceneWidget()
],
@ -304,12 +373,14 @@ class SettingHelper {
],
),
),
if (context.read<SettingBloc>().isExpanded && !isAutomation)
if (context.read<SettingBloc>().isExpanded &&
!isAutomation)
SizedBox(
width: 400,
height: 150,
child: settingState is LoadingState
? const Center(child: CircularProgressIndicator())
? const Center(
child: CircularProgressIndicator())
: GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
@ -326,7 +397,8 @@ class SettingHelper {
height: 35,
child: InkWell(
onTap: () {
BlocProvider.of<SettingBloc>(context)
BlocProvider.of<SettingBloc>(
context)
.add(SelectIcon(
iconId: iconModel.uuid,
));
@ -335,13 +407,17 @@ class SettingHelper {
child: SizedBox(
child: ClipOval(
child: Container(
padding: const EdgeInsets.all(1),
padding:
const EdgeInsets.all(
1),
decoration: BoxDecoration(
border: Border.all(
color: selectedIcon == iconModel.uuid
color: selectedIcon ==
iconModel.uuid
? ColorsManager
.primaryColorWithOpacity
: Colors.transparent,
: Colors
.transparent,
width: 2,
),
shape: BoxShape.circle,
@ -356,8 +432,12 @@ class SettingHelper {
);
},
)),
if (context.read<SettingBloc>().isExpanded && isAutomation)
const SizedBox(height: 350, width: 400, child: EffectivePeriodView())
if (context.read<SettingBloc>().isExpanded &&
isAutomation)
const SizedBox(
height: 350,
width: 400,
child: EffectivePeriodView())
],
),
Container(
@ -381,23 +461,33 @@ class SettingHelper {
alignment: AlignmentDirectional.center,
child: Text(
'Cancel',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager.textGray,
),
),
),
),
),
Container(width: 1, height: 50, color: ColorsManager.greyColor),
Container(
width: 1,
height: 50,
color: ColorsManager.greyColor),
Expanded(
child: InkWell(
onTap: () {
if (isAutomation) {
BlocProvider.of<RoutineBloc>(context).add(
EffectiveTimePeriodEvent(EffectiveTime(
start: effectPeriodState.customStartTime!,
end: effectPeriodState.customEndTime!,
loops: effectPeriodState.selectedDaysBinary)));
EffectiveTimePeriodEvent(
EffectiveTime(
start: effectPeriodState
.customStartTime!,
end: effectPeriodState
.customEndTime!,
loops: effectPeriodState
.selectedDaysBinary)));
Navigator.of(context).pop();
} else {
Navigator.of(context).pop(selectedIcon);
@ -407,8 +497,12 @@ class SettingHelper {
alignment: AlignmentDirectional.center,
child: Text(
'Confirm',
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: ColorsManager.primaryColorWithOpacity,
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(
color: ColorsManager
.primaryColorWithOpacity,
),
),
),

View File

@ -24,8 +24,7 @@ class ThreeGangSwitchHelper {
required String dialogType,
required bool removeComparetors,
}) async {
List<BaseSwitchFunction> switchFunctions =
functions.whereType<BaseSwitchFunction>().toList();
final switchFunctions = functions.whereType<BaseSwitchFunction>().toList();
return showDialog<Map<String, dynamic>?>(
context: context,

View File

@ -25,8 +25,7 @@ class TwoGangSwitchHelper {
required bool removeComparetors,
required String dialogType,
}) async {
List<BaseSwitchFunction> switchFunctions =
functions.whereType<BaseSwitchFunction>().toList();
final switchFunctions = functions.whereType<BaseSwitchFunction>().toList();
return showDialog<Map<String, dynamic>?>(
context: context,
@ -237,7 +236,7 @@ class TwoGangSwitchHelper {
DeviceFunctionData? selectedFunctionData,
// Function(String) onConditionChanged,
) {
final conditions = ["<", "==", ">"];
final conditions = ['<', '==', '>'];
return ToggleButtons(
onPressed: (int index) {
@ -264,8 +263,8 @@ class TwoGangSwitchHelper {
minWidth: 40.0,
),
isSelected:
conditions.map((c) => c == (currentCondition ?? "==")).toList(),
children: conditions.map((c) => Text(c)).toList(),
conditions.map((c) => c == (currentCondition ?? '==')).toList(),
children: conditions.map(Text.new).toList(),
);
}
@ -280,7 +279,7 @@ class TwoGangSwitchHelper {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: BoxDecoration(
color: ColorsManager.primaryColorWithOpacity.withOpacity(0.1),
color: ColorsManager.primaryColorWithOpacity.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(10),
),
child: Text(

View File

@ -49,8 +49,6 @@ class _TimeWheelPickerState extends State<TimeWheelPicker> {
}
}
@override
void dispose() {
_hoursController.dispose();
@ -103,7 +101,7 @@ class _TimeWheelPickerState extends State<TimeWheelPicker> {
}
void _handleTimeChange(int hours, int minutes, int seconds) {
int total = hours * 3600 + minutes * 60 + seconds;
var total = hours * 3600 + minutes * 60 + seconds;
if (total > 10000) {
hours = 2;
minutes = 46;

View File

@ -63,7 +63,8 @@ class _WallPresenceSensorState extends State<WallPresenceSensor> {
@override
void initState() {
super.initState();
_wpsFunctions = widget.functions.whereType<WpsFunctions>().where((function) {
_wpsFunctions =
widget.functions.whereType<WpsFunctions>().where((function) {
if (widget.dialogType == 'THEN') {
return function.type == 'THEN' || function.type == 'BOTH';
}

View File

@ -30,7 +30,8 @@ class WpsOperationalValuesList extends StatelessWidget {
: ListView.builder(
padding: const EdgeInsets.all(20),
itemCount: values.length,
itemBuilder: (context, index) => _buildValueItem(context, values[index]),
itemBuilder: (context, index) =>
_buildValueItem(context, values[index]),
);
}
@ -61,7 +62,8 @@ class WpsOperationalValuesList extends StatelessWidget {
Widget _buildValueIcon(context, WpsOperationalValue value) {
return Column(
children: [
if (_shouldShowTextDescription) Text(value.description.replaceAll("cm", '')),
if (_shouldShowTextDescription)
Text(value.description.replaceAll('cm', '')),
SvgPicture.asset(value.icon, width: 25, height: 25),
],
);

View File

@ -61,5 +61,4 @@ class WaterHeaterOperationalValuesList extends StatelessWidget {
groupValue: selectedValue,
onChanged: (_) => onSelect(value));
}
}

View File

@ -12,7 +12,7 @@ class WaterHeaterValueSelectorWidget extends StatelessWidget {
final DeviceFunctionData functionData;
final List<WaterHeaterFunctions> whFunctions;
final AllDevicesModel? device;
final String dialogType;
final String dialogType;
const WaterHeaterValueSelectorWidget({
required this.selectedFunction,
@ -39,14 +39,13 @@ class WaterHeaterValueSelectorWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildCountDownSlider(
context,
functionData.value,
device,
selectedFn.operationName,
functionData,
selectedFunction,
dialogType
),
context,
functionData.value,
device,
selectedFn.operationName,
functionData,
selectedFunction,
dialogType),
const SizedBox(height: 10),
],
);