Files
syncrow-app/lib/features/devices/view/widgets/universal_a_c_switch.dart
Mohammad Salameh abe7072f2d AC devices page implemented
AC Cubit Add
New Devices Cubit Arch will be used
Devices Cubit (for devices categories, and devices page)
{
AC cubit,
Lights cubit.
... }
Replaced AssetsManager with Assets Class (auto generated)
2024-02-26 15:55:22 +03:00

71 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import '../../../../utils/resource_manager/color_manager.dart';
import '../../../shared_widgets/text_widgets/body_medium.dart';
import '../../bloc/ac_cubit.dart';
class UniversalACSwitch extends StatelessWidget {
const UniversalACSwitch({
super.key,
});
@override
Widget build(BuildContext context) {
bool acsStatus = AcCubit.get(context).areAllACsOff();
//TODO: Move these to String Manager "ON" and "OFF"
return Row(
children: <Widget>[
Expanded(
child: InkWell(
onTap: () {
AcCubit.get(context).turnAllACsOn();
},
child: Container(
height: 60,
decoration: BoxDecoration(
color: acsStatus ? ColorsManager.primaryColor : Colors.white,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15),
bottomLeft: Radius.circular(15),
),
),
child: Center(
child: BodyMedium(
text: "ON",
fontColor: acsStatus ? Colors.white : null,
fontWeight: FontWeight.bold,
),
),
),
),
),
Expanded(
child: InkWell(
onTap: () {
AcCubit.get(context).turnAllACsOff();
},
child: Container(
height: 60,
decoration: BoxDecoration(
color: acsStatus ? Colors.white : ColorsManager.primaryColor,
borderRadius: const BorderRadius.only(
topRight: Radius.circular(15),
bottomRight: Radius.circular(15),
),
),
child: Center(
child: BodyMedium(
text: "OFF",
fontColor: acsStatus ? null : Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
);
}
}