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),
      ],
    );
  }
}
