mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 21:17:55 +00:00
fix time period read from api and setting visibility
This commit is contained in:
@@ -207,7 +207,7 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
|
||||
: null,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
groupValue = value;
|
||||
groupValue = normalizeValue(value);
|
||||
});
|
||||
context.read<CreateSceneBloc>().add(SelectedValueEvent(
|
||||
value: _deNormalizeValue(groupValue),
|
||||
@@ -228,6 +228,10 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
|
||||
);
|
||||
}
|
||||
|
||||
double normalizeValue(double value) {
|
||||
return double.parse(value.toStringAsFixed(1));
|
||||
}
|
||||
|
||||
double _deNormalizeValue(double? value) {
|
||||
if (widget.taskItem.code == "temp_set" ||
|
||||
widget.taskItem.code == "temp_current") {
|
||||
|
||||
+20
-25
@@ -1,6 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/scene/bloc/effective_period/effect_period_bloc.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/period_options.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/repeat_days.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
@@ -14,29 +12,26 @@ class EffectPeriodBottomSheetContent extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => EffectPeriodBloc(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BodyMedium(
|
||||
text: 'Effective Period',
|
||||
fontColor: ColorsManager.primaryColorWithOpacity,
|
||||
fontWeight: FontsManager.bold,
|
||||
),
|
||||
const Divider(
|
||||
color: ColorsManager.backgroundColor,
|
||||
),
|
||||
const PeriodOptions(
|
||||
showCustomTimePicker: EffectPeriodHelper.showCustomTimePicker,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const RepeatDays(),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BodyMedium(
|
||||
text: 'Effective Period',
|
||||
fontColor: ColorsManager.primaryColorWithOpacity,
|
||||
fontWeight: FontsManager.bold,
|
||||
),
|
||||
const Divider(
|
||||
color: ColorsManager.backgroundColor,
|
||||
),
|
||||
const PeriodOptions(
|
||||
showCustomTimePicker: EffectPeriodHelper.showCustomTimePicker,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const RepeatDays(),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,13 @@ class ThenAddedTasksContainer extends StatelessWidget
|
||||
operationValue = '0°C';
|
||||
}
|
||||
} else {
|
||||
final functionValue =
|
||||
var functionValue =
|
||||
taskItem.functionValue ?? taskItem.operationalValues.first.value;
|
||||
|
||||
if (functionValue is double) {
|
||||
functionValue = double.parse(functionValue.toStringAsFixed(1));
|
||||
}
|
||||
|
||||
operationValue = functionValue.toString();
|
||||
}
|
||||
return DefaultContainer(
|
||||
|
||||
Reference in New Issue
Block a user