mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-25 21:49:40 +00:00
60 lines
2.0 KiB
Dart
60 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
// import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
// import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/two_gang_bloc.dart';
|
|
// import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/two_gang_state.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
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,
|
|
required this.action});
|
|
|
|
final DeviceModel threeGangSwitch;
|
|
final bool value;
|
|
final Function action;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
overlayColor: WidgetStateProperty.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,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|