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.
77 lines
2.5 KiB
Dart
77 lines
2.5 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_medium.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/united_text.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 LightInterfaceSlider extends StatelessWidget {
|
|
const LightInterfaceSlider({
|
|
super.key,
|
|
required this.light,
|
|
});
|
|
|
|
final DeviceModel light;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
BodyMedium(
|
|
text: StringsManager.dimmerAndColor,
|
|
style: context.bodyMedium.copyWith(color: Colors.grey),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Expanded(
|
|
child: UnitedText(
|
|
// value: light.brightness.toString(),
|
|
value: '100',
|
|
unit: "%",
|
|
valueStyle: context.bodyMedium.copyWith(
|
|
color: Colors.grey,
|
|
fontSize: 26,
|
|
),
|
|
unitStyle: context.bodyMedium.copyWith(
|
|
color: Colors.grey,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 2,
|
|
child: SliderTheme(
|
|
data: SliderTheme.of(context).copyWith(
|
|
thumbColor: ColorsManager.primaryColor,
|
|
rangeThumbShape: const RoundRangeSliderThumbShape(
|
|
enabledThumbRadius: 9,
|
|
),
|
|
thumbShape: const RoundSliderThumbShape(
|
|
enabledThumbRadius: 9,
|
|
),
|
|
activeTrackColor: ColorsManager.greyColor,
|
|
inactiveTrackColor: ColorsManager.greyColor,
|
|
trackHeight: 5,
|
|
),
|
|
child: Slider(
|
|
// value: light.brightness,
|
|
value: 100,
|
|
onChanged: (value) {
|
|
// DevicesCubit.getInstance().setBrightness(light, value);
|
|
},
|
|
min: 0,
|
|
max: 100,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 10),
|
|
],
|
|
);
|
|
}
|
|
}
|