mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
83 lines
2.5 KiB
Dart
83 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class AlertDialogTemperatureBody extends StatefulWidget {
|
|
const AlertDialogTemperatureBody({
|
|
super.key,
|
|
required this.index,
|
|
required this.functions,
|
|
});
|
|
|
|
final List<SceneStaticFunction> functions;
|
|
final int index;
|
|
|
|
@override
|
|
State<AlertDialogTemperatureBody> createState() =>
|
|
_AlertDialogTemperatureBodyState();
|
|
}
|
|
|
|
class _AlertDialogTemperatureBodyState
|
|
extends State<AlertDialogTemperatureBody> {
|
|
double temperature = 16;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListTile(
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
|
|
leading: IconButton(
|
|
onPressed: () {
|
|
setState(() {
|
|
temperature--;
|
|
});
|
|
},
|
|
icon: const Icon(
|
|
Icons.remove,
|
|
size: 32,
|
|
color: ColorsManager.greyColor,
|
|
)),
|
|
title: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
TitleMedium(
|
|
text: temperature.toString(),
|
|
style: context.titleMedium.copyWith(
|
|
color: ColorsManager.primaryColorWithOpacity,
|
|
fontSize: 30,
|
|
)),
|
|
const SizedBox(width: 4),
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 8.0),
|
|
child: SvgPicture.asset(
|
|
Assets.assetsCelsiusDegrees,
|
|
alignment: Alignment.topCenter,
|
|
width: 32,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
subtitle: BodyLarge(
|
|
text: widget.functions[widget.index].operationalValues[0].value,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
trailing: IconButton(
|
|
onPressed: () {
|
|
setState(() {
|
|
temperature++;
|
|
});
|
|
},
|
|
icon: const Icon(
|
|
Icons.add,
|
|
size: 32,
|
|
color: ColorsManager.greyColor,
|
|
)),
|
|
);
|
|
}
|
|
}
|