mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 21:34:54 +00:00
light interface
This commit is contained in:
@ -0,0 +1,74 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/lights/lights_cubit.dart';
|
||||
import 'package:syncrow_app/features/devices/model/light_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 LightModel 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(),
|
||||
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,
|
||||
onChanged: (value) =>
|
||||
LightsCubit.get(context).setBrightness(light, value),
|
||||
min: 0,
|
||||
max: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user