mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 04:29:40 +00:00
Implemented ceiling, wall sensors functionality
This commit is contained in:
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user