mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
83 lines
2.7 KiB
Dart
83 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
|
|
import '../../../../../utils/resource_manager/color_manager.dart';
|
|
import '../../../../shared_widgets/text_widgets/body_medium.dart';
|
|
import '../../../bloc/AC/ac_cubit.dart';
|
|
|
|
class UniversalACSwitch extends StatelessWidget {
|
|
const UniversalACSwitch({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
//TODO: Move these to String Manager "ON" and "OFF"
|
|
return BlocBuilder<AcCubit, AcState>(
|
|
builder: (context, state) {
|
|
return Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
AcCubit.get(context).turnAllACsOn();
|
|
},
|
|
child: Container(
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: DevicesCubit.categories[0].devicesStatus
|
|
? ColorsManager.primaryColor
|
|
: Colors.white,
|
|
borderRadius: const BorderRadius.only(
|
|
topLeft: Radius.circular(15),
|
|
bottomLeft: Radius.circular(15),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: BodyMedium(
|
|
text: "ON",
|
|
fontColor: DevicesCubit.categories[0].devicesStatus
|
|
? Colors.white
|
|
: null,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
AcCubit.get(context).turnAllACsOff();
|
|
},
|
|
child: Container(
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: DevicesCubit.categories[0].devicesStatus
|
|
? Colors.white
|
|
: ColorsManager.primaryColor,
|
|
borderRadius: const BorderRadius.only(
|
|
topRight: Radius.circular(15),
|
|
bottomRight: Radius.circular(15),
|
|
),
|
|
),
|
|
child: Center(
|
|
child: BodyMedium(
|
|
text: "OFF",
|
|
fontColor: DevicesCubit.categories[0].devicesStatus
|
|
? null
|
|
: Colors.white,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|