Files
syncrow-app/lib/features/devices/view/widgets/lights/light_interface_switch.dart
Mohammad Salameh bff4b9493c Refactor device control logic and add temperature and fan speed enums
- 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.
2024-04-03 18:54:21 +03:00

69 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:syncrow_app/features/devices/model/device_model.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 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
import '../../../../shared_widgets/default_container.dart';
class LightInterfaceSwitch extends StatelessWidget {
const LightInterfaceSwitch({
super.key,
required this.light,
});
final DeviceModel light;
@override
Widget build(BuildContext context) {
return DefaultContainer(
boxConstraints: const BoxConstraints(
maxHeight: 65,
),
margin: const EdgeInsets.symmetric(vertical: 10),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyLarge(
text: light.isOnline ?? false
? StringsManager.on
: StringsManager.off,
style:
context.bodyLarge.copyWith(color: Colors.grey, fontSize: 24),
),
Container(
width: 35,
decoration: ShapeDecoration(
color: light.isOnline ?? false
? ColorsManager.primaryColorWithOpacity
: Colors.grey,
shape: const CircleBorder(),
),
child: Center(
child: IconButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(
const EdgeInsets.all(0),
),
iconSize: MaterialStateProperty.all(25),
),
onPressed: () {
// DevicesCubit.getInstance().toggleLight(light);
},
icon: const Icon(
Icons.power_settings_new,
color: Colors.white,
),
),
),
),
],
),
),
);
}
}