mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
space type connection
This commit is contained in:
@ -1,24 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart';
|
||||
|
||||
class PresenceSpaceType extends StatelessWidget {
|
||||
const PresenceSpaceType({
|
||||
super.key,
|
||||
required this.listOfIcons,
|
||||
required this.description,
|
||||
required this.value,
|
||||
required this.action,
|
||||
});
|
||||
|
||||
final List<String> listOfIcons;
|
||||
final String description;
|
||||
final String value;
|
||||
final SpaceTypes value;
|
||||
final void Function(String value) action;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Map<SpaceTypes, String> spaceTypeIcons = {
|
||||
SpaceTypes.none: Assets.office,
|
||||
SpaceTypes.parlour: Assets.parlour,
|
||||
SpaceTypes.area: Assets.dyi,
|
||||
SpaceTypes.toilet: Assets.bathroom,
|
||||
SpaceTypes.bedroom: Assets.bedroom,
|
||||
};
|
||||
|
||||
return DeviceControlsContainer(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -38,23 +47,28 @@ class PresenceSpaceType extends StatelessWidget {
|
||||
Wrap(
|
||||
runSpacing: 8,
|
||||
spacing: 16,
|
||||
children: [
|
||||
...listOfIcons.map((icon) => Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
border: Border.all(
|
||||
color: icon.contains(value)
|
||||
? ColorsManager.blueColor
|
||||
: Colors.transparent,
|
||||
),
|
||||
children: spaceTypeIcons.entries.map((entry) {
|
||||
final icon = entry.value;
|
||||
final spaceType = entry.key;
|
||||
return GestureDetector(
|
||||
onTap: () => action(spaceType.name),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
border: Border.all(
|
||||
color: value == spaceType
|
||||
? ColorsManager.blueColor
|
||||
: Colors.transparent,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
icon,
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
icon,
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
Reference in New Issue
Block a user