mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
74 lines
2.0 KiB
Dart
74 lines
2.0 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:syncrow_web/utils/color_manager.dart';
|
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
|
|
class CurtainToggle extends StatelessWidget {
|
|
final bool value;
|
|
final String code;
|
|
final String deviceId;
|
|
final String label;
|
|
final Null Function(dynamic value) onChanged;
|
|
|
|
const CurtainToggle({
|
|
super.key,
|
|
required this.value,
|
|
required this.code,
|
|
required this.deviceId,
|
|
required this.label,
|
|
required this.onChanged,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: ColorsManager.greyColor.withOpacity(0.2),
|
|
border: Border.all(color: ColorsManager.boxDivider),
|
|
),
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
ClipOval(
|
|
child: Container(
|
|
color: ColorsManager.whiteColors,
|
|
child: SvgPicture.asset(
|
|
Assets.curtainIcon,
|
|
width: 60,
|
|
height: 60,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
width: 35,
|
|
child: CupertinoSwitch(
|
|
value: value,
|
|
activeColor: ColorsManager.dialogBlueTitle,
|
|
onChanged: onChanged,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const Spacer(),
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 14,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|