mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 14:44:55 +00:00
light interface
This commit is contained in:
@ -0,0 +1,72 @@
|
||||
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/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 LightModel 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(
|
||||
LightsCubit.get(context).lightModes.length,
|
||||
(index) => InkWell(
|
||||
onTap: () => LightsCubit.get(context).setLightingMode(
|
||||
light, LightsCubit.get(context).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)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user