mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00

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)
71 lines
2.0 KiB
Dart
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,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|