mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
100 lines
4.2 KiB
Dart
100 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.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/devices/view/widgets/lights/light_interface_switch.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/lights/light_interface_timer.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';
|
|
|
|
import '../../../../shared_widgets/default_container.dart';
|
|
|
|
class LightInterface extends StatelessWidget {
|
|
const LightInterface({super.key, required this.light});
|
|
|
|
final LightModel light;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<LightsCubit, LightsState>(
|
|
builder: (context, state) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: 70, right: 20, left: 20),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
LightInterfaceSwitch(light: light),
|
|
DefaultContainer(
|
|
boxConstraints: const BoxConstraints(
|
|
maxHeight: 310,
|
|
),
|
|
padding: const EdgeInsets.all(25),
|
|
margin: const EdgeInsets.symmetric(vertical: 10),
|
|
child: 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: Colors.grey.withOpacity(.8),
|
|
inactiveTrackColor: Colors.grey.withOpacity(.8),
|
|
trackHeight: 5,
|
|
),
|
|
child: Slider(
|
|
value: light.brightness,
|
|
onChanged: (value) => LightsCubit.get(context)
|
|
.setBrightness(light, value),
|
|
min: 0,
|
|
max: 100,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
const LightInterfaceTimer(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|