mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 01:35:23 +00:00

AC Cubit Add New Devices Cubit Arch will be used Devices Cubit (for devices categories, and devices page) { AC cubit, Lights cubit. ... } Replaced AssetsManager with Assets Class (auto generated)
76 lines
1.8 KiB
Dart
76 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:gap/gap.dart';
|
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
|
|
import '../../../../generated/assets.dart';
|
|
|
|
class ACControlUnit extends StatefulWidget {
|
|
const ACControlUnit({
|
|
super.key,
|
|
required this.model,
|
|
});
|
|
|
|
final ACModel model;
|
|
|
|
@override
|
|
State<ACControlUnit> createState() => _ACControlUnitState();
|
|
}
|
|
|
|
class _ACControlUnitState extends State<ACControlUnit> {
|
|
var fanSpeeds = [
|
|
Assets.iconsFan0,
|
|
Assets.iconsFan1,
|
|
Assets.iconsFan2,
|
|
Assets.iconsFan3,
|
|
];
|
|
|
|
var tempModes = [
|
|
Assets.iconsSunnyMode,
|
|
Assets.iconsColdMode,
|
|
Assets.iconsWindyMode,
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Row(
|
|
children: [
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
widget.model.fanSpeed =
|
|
widget.model.fanSpeed == 3 ? 0 : widget.model.fanSpeed + 1;
|
|
});
|
|
},
|
|
child: DefaultContainer(
|
|
height: 55,
|
|
child: Center(
|
|
child: SvgPicture.asset(fanSpeeds[widget.model.fanSpeed]),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Gap(10),
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
widget.model.tempMode =
|
|
widget.model.tempMode == 2 ? 0 : widget.model.tempMode + 1;
|
|
});
|
|
},
|
|
child: DefaultContainer(
|
|
height: 55,
|
|
child: Center(
|
|
child: SvgPicture.asset(tempModes[widget.model.tempMode]),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|