mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00

- Refactor device control logic in the app to improve readability and maintainability. - Add temperature modes (hot, cold, wind) and fan speeds (auto, low, middle, high) enums. - Update icon mappings and utility functions for temperature modes and fan speeds.
71 lines
2.3 KiB
Dart
71 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
import '../../../../../generated/assets.dart';
|
|
|
|
class ACTempWidget extends StatelessWidget {
|
|
const ACTempWidget(
|
|
this.deviceModel, {
|
|
super.key,
|
|
});
|
|
|
|
final DeviceModel deviceModel;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
|
builder: (context, state) {
|
|
return DefaultContainer(
|
|
height: 60,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
SizedBox.square(
|
|
dimension: 24,
|
|
child: InkWell(
|
|
onTap: () {
|
|
// DevicesCubit.getInstance()
|
|
// .setACTemp(DeviceModel, DeviceModel.temperature - 0.5);
|
|
},
|
|
child: SvgPicture.asset(
|
|
Assets.iconsMinus,
|
|
),
|
|
),
|
|
),
|
|
BodyLarge(
|
|
// text: "${DeviceModel.temperature}° C",
|
|
text: '25 °C',
|
|
style: context.bodyLarge.copyWith(
|
|
color: ColorsManager.primaryColor.withOpacity(0.6),
|
|
fontSize: 23,
|
|
),
|
|
),
|
|
SizedBox.square(
|
|
dimension: 24,
|
|
child: InkWell(
|
|
onTap: () {
|
|
// DevicesCubit.getInstance()
|
|
// .setACTemp(DeviceModel, DeviceModel.temperature + 0.5);
|
|
},
|
|
child: SvgPicture.asset(
|
|
Assets.iconsPlus,
|
|
height: 24,
|
|
width: 24,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|