Implemented ceiling, wall sensors functionality

This commit is contained in:
Abdullah Alassaf
2024-05-22 23:55:35 +03:00
parent 008ba8be32
commit 44b08c482d
26 changed files with 1296 additions and 493 deletions

View File

@ -8,56 +8,49 @@ import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class GangSwitch extends StatelessWidget {
const GangSwitch({
super.key,
required this.threeGangSwitch,
required this.value,
});
const GangSwitch(
{super.key, required this.threeGangSwitch, required this.value, required this.action});
final DeviceModel threeGangSwitch;
final bool value;
final Function action;
@override
Widget build(BuildContext context) {
return BlocBuilder<ThreeGangBloc, ThreeGangState>(
builder: (context, state) {
return InkWell(
overlayColor: MaterialStateProperty.all(Colors.transparent),
onTap: () {
// var tempControl = DeviceControlModel(
// deviceId: control.deviceId, code: control.code!, value: !control.value!);
// DevicesCubit.getInstance().deviceControl(
// tempControl,
// control.deviceId!,
// );
},
child: Stack(
alignment: value ? Alignment.topCenter : Alignment.bottomCenter,
children: [
Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(100.0)),
color:
value ? ColorsManager.primaryColorWithOpacity : ColorsManager.switchOffColor,
),
width: 60,
height: 115,
),
Padding(
padding: const EdgeInsets.all(5.0),
child: SizedBox.square(
dimension: 60,
child: SvgPicture.asset(
value ? Assets.assetsIconsLightSwitchOn : Assets.assetsIconsLightSwitchOff,
fit: BoxFit.fill,
),
),
),
],
),
);
return InkWell(
overlayColor: MaterialStateProperty.all(Colors.transparent),
onTap: () {
action();
// var tempControl = DeviceControlModel(
// deviceId: control.deviceId, code: control.code!, value: !control.value!);
// DevicesCubit.getInstance().deviceControl(
// tempControl,
// control.deviceId!,
// );
},
child: Stack(
alignment: value ? Alignment.topCenter : Alignment.bottomCenter,
children: [
Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(100.0)),
color: value ? ColorsManager.primaryColorWithOpacity : ColorsManager.switchOffColor,
),
width: 60,
height: 115,
),
Padding(
padding: const EdgeInsets.all(5.0),
child: SizedBox.square(
dimension: 60,
child: SvgPicture.asset(
value ? Assets.assetsIconsLightSwitchOn : Assets.assetsIconsLightSwitchOff,
fit: BoxFit.fill,
),
),
),
],
),
);
}
}