mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 15:27:55 +00:00
added Null state from the AC universal switch (in case the status for the ACs are different from each other)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
import '../../../../../utils/resource_manager/color_manager.dart';
|
||||
import '../../../../shared_widgets/text_widgets/body_medium.dart';
|
||||
@@ -13,9 +14,9 @@ class UniversalACSwitch extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//TODO: Move these to String Manager "ON" and "OFF"
|
||||
return BlocBuilder<AcCubit, AcState>(
|
||||
builder: (context, state) {
|
||||
bool? status = DevicesCubit.categories[0].devicesStatus;
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
@@ -26,8 +27,10 @@ class UniversalACSwitch extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: DevicesCubit.categories[0].devicesStatus
|
||||
? ColorsManager.primaryColor
|
||||
color: status != null
|
||||
? status
|
||||
? ColorsManager.primaryColor
|
||||
: Colors.white
|
||||
: Colors.white,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(15),
|
||||
@@ -36,9 +39,11 @@ class UniversalACSwitch extends StatelessWidget {
|
||||
),
|
||||
child: Center(
|
||||
child: BodyMedium(
|
||||
text: "ON",
|
||||
fontColor: DevicesCubit.categories[0].devicesStatus
|
||||
? Colors.white
|
||||
text: StringsManager.on,
|
||||
fontColor: status != null
|
||||
? status
|
||||
? Colors.white
|
||||
: null
|
||||
: null,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -54,9 +59,11 @@ class UniversalACSwitch extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: DevicesCubit.categories[0].devicesStatus
|
||||
? Colors.white
|
||||
: ColorsManager.primaryColor,
|
||||
color: status != null
|
||||
? status
|
||||
? Colors.white
|
||||
: ColorsManager.primaryColor
|
||||
: Colors.white,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(15),
|
||||
bottomRight: Radius.circular(15),
|
||||
@@ -64,10 +71,12 @@ class UniversalACSwitch extends StatelessWidget {
|
||||
),
|
||||
child: Center(
|
||||
child: BodyMedium(
|
||||
text: "OFF",
|
||||
fontColor: DevicesCubit.categories[0].devicesStatus
|
||||
? null
|
||||
: Colors.white,
|
||||
text: StringsManager.off,
|
||||
fontColor: status != null
|
||||
? status
|
||||
? null
|
||||
: Colors.white
|
||||
: null,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user