Files
syncrow-app/lib/features/devices/view/widgets/lights/light_interface_modes.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

73 lines
2.5 KiB
Dart

import 'package:flutter/material.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/text_widgets/body_medium.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';
class LightInterfaceModes extends StatelessWidget {
const LightInterfaceModes({
super.key,
required this.light,
});
final DeviceModel light;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BodyMedium(
text: StringsManager.lightingModes,
style: context.bodyMedium.copyWith(color: Colors.grey),
),
const SizedBox(height: 10),
Wrap(
spacing: 25,
children: List.generate(
DevicesCubit.getInstance().lightModes.length,
(index) => InkWell(
// onTap: () => DevicesCubit.getInstance().setLightingMode(
// light, DevicesCubit.getInstance().lightModes[index]!),
child: Column(
children: [
Container(
width: 40,
height: 40,
decoration: ShapeDecoration(
shape: const CircleBorder(),
color: switch (index) {
0 => ColorsManager.dozeColor,
1 => ColorsManager.relaxColor,
2 => ColorsManager.readingColor,
3 => ColorsManager.energizingColor,
_ => ColorsManager.primaryColor,
},
),
),
BodyMedium(
text: switch (index) {
0 => StringsManager.doze,
1 => StringsManager.relax,
2 => StringsManager.reading,
3 => StringsManager.energizing,
_ => "",
},
style: context.bodyMedium.copyWith(
color: Colors.grey,
fontSize: 10,
),
)
],
),
),
),
),
const SizedBox(height: 10)
],
);
}
}