mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
Implemented room device interface
(AC only)
This commit is contained in:
@ -12,6 +12,7 @@ import 'package:syncrow_app/features/devices/view/widgets/gateway/gateway_view.d
|
||||
import 'package:syncrow_app/features/devices/view/widgets/lights/lights_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_view.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
part 'spaces_state.dart';
|
||||
|
||||
@ -36,7 +37,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
fanSpeed: 0,
|
||||
tempMode: 0,
|
||||
coolTo: 20,
|
||||
type: '',
|
||||
type: DeviceType.AC,
|
||||
image: '',
|
||||
timer: null,
|
||||
bounds: Bounds(
|
||||
@ -60,7 +61,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
brightness: 20,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -89,7 +90,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
id: "1",
|
||||
name: "Living Room Curtain",
|
||||
status: false,
|
||||
type: '',
|
||||
type: DeviceType.Curtain,
|
||||
image: '',
|
||||
timer: null,
|
||||
),
|
||||
@ -118,7 +119,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
fanSpeed: 0,
|
||||
tempMode: 0,
|
||||
coolTo: 20,
|
||||
type: '',
|
||||
type: DeviceType.AC,
|
||||
image: '',
|
||||
timer: null,
|
||||
bounds: Bounds(
|
||||
@ -142,7 +143,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
brightness: 20,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -171,7 +172,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
id: "1",
|
||||
name: "Living Room Curtain",
|
||||
status: false,
|
||||
type: '',
|
||||
type: DeviceType.Curtain,
|
||||
image: '',
|
||||
timer: null,
|
||||
),
|
||||
@ -229,7 +230,6 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
unselectRoom();
|
||||
} else {
|
||||
selectedRoom = selectedSpace.rooms[index - 1];
|
||||
print(selectedRoom!.name);
|
||||
}
|
||||
emit(RoomSelected(selectedRoom!));
|
||||
}
|
||||
@ -245,7 +245,6 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
unselectRoom();
|
||||
} else {
|
||||
selectedRoom = selectedSpace.rooms[index - 1];
|
||||
print(selectedRoom!.name);
|
||||
}
|
||||
emit(RoomSelected(selectedRoom!));
|
||||
}
|
||||
|
@ -2,17 +2,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/curtain_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/light_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/gateway/gateway_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/lights/lights_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/screens/screens_view.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_view.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
|
||||
import '../model/device_category_model.dart';
|
||||
import '../view/widgets/ACs/acs_view.dart';
|
||||
import '../view/widgets/lights/lights_view.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
part 'devices_state.dart';
|
||||
|
||||
@ -32,7 +32,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
fanSpeed: 0,
|
||||
tempMode: 0,
|
||||
coolTo: 20,
|
||||
type: '',
|
||||
type: DeviceType.AC,
|
||||
image: '',
|
||||
timer: null,
|
||||
bounds: Bounds(
|
||||
@ -48,7 +48,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
fanSpeed: 0,
|
||||
tempMode: 0,
|
||||
coolTo: 20,
|
||||
type: '',
|
||||
type: DeviceType.AC,
|
||||
image: '',
|
||||
timer: null,
|
||||
bounds: Bounds(
|
||||
@ -64,7 +64,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
fanSpeed: 0,
|
||||
tempMode: 0,
|
||||
coolTo: 20,
|
||||
type: '',
|
||||
type: DeviceType.AC,
|
||||
image: '',
|
||||
timer: null,
|
||||
bounds: Bounds(
|
||||
@ -80,7 +80,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
fanSpeed: 0,
|
||||
tempMode: 0,
|
||||
coolTo: 20,
|
||||
type: '',
|
||||
type: DeviceType.AC,
|
||||
image: '',
|
||||
timer: null,
|
||||
bounds: Bounds(
|
||||
@ -104,7 +104,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
brightness: 20,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -121,7 +121,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
brightness: 40,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -138,7 +138,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
brightness: 60,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -155,7 +155,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
brightness: 80,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -172,7 +172,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
brightness: 100,
|
||||
lightingMode: 1,
|
||||
timer: null,
|
||||
type: '',
|
||||
type: DeviceType.Lights,
|
||||
image: '',
|
||||
recentColors: [
|
||||
0xFF83D9FF,
|
||||
@ -201,7 +201,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
id: "1",
|
||||
name: "Living Room Curtain",
|
||||
status: false,
|
||||
type: '',
|
||||
type: DeviceType.Curtain,
|
||||
image: '',
|
||||
timer: null,
|
||||
),
|
||||
@ -210,7 +210,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
id: "2",
|
||||
name: "Master Bedroom Curtain",
|
||||
status: false,
|
||||
type: '',
|
||||
type: DeviceType.Curtain,
|
||||
image: '',
|
||||
timer: null,
|
||||
),
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
class DevicesCategoryModel {
|
||||
final String name;
|
||||
@ -35,12 +36,3 @@ class DevicesCategoryModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum DeviceType {
|
||||
AC,
|
||||
Lights,
|
||||
Door,
|
||||
Curtain,
|
||||
Screens,
|
||||
Gateway,
|
||||
}
|
||||
|
@ -1,10 +1,15 @@
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
abstract class DeviceModel {
|
||||
final String? id;
|
||||
final String? name;
|
||||
final String? type;
|
||||
final DeviceType? type;
|
||||
bool? status;
|
||||
final String? image;
|
||||
final double? timer;
|
||||
|
||||
late final String icon;
|
||||
bool isSelected = false;
|
||||
|
||||
DeviceModel({
|
||||
@ -14,5 +19,25 @@ abstract class DeviceModel {
|
||||
required this.status,
|
||||
required this.image,
|
||||
required this.timer,
|
||||
});
|
||||
}) {
|
||||
switch (type) {
|
||||
case DeviceType.AC:
|
||||
icon = Assets.iconsAC;
|
||||
break;
|
||||
case DeviceType.Lights:
|
||||
icon = Assets.iconsLight;
|
||||
break;
|
||||
case DeviceType.Door:
|
||||
icon = Assets.iconsDoorLock;
|
||||
break;
|
||||
case DeviceType.Curtain:
|
||||
icon = Assets.iconsCurtain;
|
||||
break;
|
||||
case DeviceType.Gateway:
|
||||
icon = Assets.iconsGateway;
|
||||
break;
|
||||
default:
|
||||
icon = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_controls.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_temp_unit.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||
|
||||
class AcInterface extends StatelessWidget {
|
||||
const AcInterface({super.key, required this.acModel});
|
||||
@ -12,7 +16,44 @@ class AcInterface extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
return AnnotatedRegion(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorsManager.backgroundColor,
|
||||
extendBodyBehindAppBar: true,
|
||||
extendBody: true,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
centerTitle: true,
|
||||
title: BodyLarge(
|
||||
text: acModel.name ?? "",
|
||||
fontColor: ColorsManager.primaryColor,
|
||||
fontWeight: FontsManager.bold,
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
Assets.imagesBackground,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
opacity: 0.4,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constants.appBarHeight,
|
||||
left: Constants.defaultPadding,
|
||||
right: Constants.defaultPadding,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@ -37,6 +78,11 @@ class AcInterface extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,9 @@ class AcInterfaceTempUnit extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<AcCubit, AcState>(
|
||||
return BlocProvider(
|
||||
create: (context) => AcCubit(),
|
||||
child: BlocBuilder<AcCubit, AcState>(
|
||||
builder: (context, state) {
|
||||
return DefaultContainer(
|
||||
child: Column(
|
||||
@ -78,7 +80,7 @@ class AcInterfaceTempUnit extends StatelessWidget {
|
||||
if (valueAsString.endsWith(".0") ||
|
||||
valueAsString.endsWith(".5")) {
|
||||
value = double.parse(valueAsString);
|
||||
AcCubit.get(context).setTempToAll(value);
|
||||
AcCubit.get(context).setACTemp(acModel, value);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -141,6 +143,7 @@ class AcInterfaceTempUnit extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/room_page_switch.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
class RoomPage extends StatelessWidget {
|
||||
@ -16,6 +13,10 @@ class RoomPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<DeviceModel> devices = [];
|
||||
for (var category in room.categories) {
|
||||
devices.addAll(category.devices);
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: Constants.defaultPadding),
|
||||
child: SingleChildScrollView(
|
||||
@ -31,63 +32,9 @@ class RoomPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: room.categories.length,
|
||||
itemCount: devices.length,
|
||||
itemBuilder: (_, index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
DevicesCubit.get(context).selectCategory(index);
|
||||
//Navigate to the chosen category view without animation
|
||||
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// CustomPageRoute(
|
||||
// builder: (context) {
|
||||
// return DevicesCubit.get(context)
|
||||
// .chosenCategoryView!;
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
child: DefaultContainer(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 10, right: 10, left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
room.categories[index].icon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
CustomSwitch(
|
||||
category: room.categories[index],
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: BodyLarge(
|
||||
text: room.categories[index].name,
|
||||
style: context.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 0,
|
||||
fontSize: 24,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return RoomPageSwitch(device: devices[index]);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
86
lib/features/devices/view/widgets/room_page_switch.dart
Normal file
86
lib/features/devices/view/widgets/room_page_switch.dart
Normal file
@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
class RoomPageSwitch extends StatelessWidget {
|
||||
const RoomPageSwitch({
|
||||
super.key,
|
||||
required this.device,
|
||||
});
|
||||
|
||||
final DeviceModel device;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
//Navigate to the chosen category view without animation
|
||||
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// CustomPageRoute(
|
||||
// builder: (context) {
|
||||
// return DevicesCubit.get(context)
|
||||
// .chosenCategoryView!;
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
|
||||
if (device.type == DeviceType.AC) {
|
||||
Navigator.push(
|
||||
context,
|
||||
CustomPageRoute(
|
||||
builder: (context) => AcInterface(acModel: device as ACModel),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: DefaultContainer(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 10, right: 10, left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
device.icon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
CustomSwitch(
|
||||
device: device,
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: BodyLarge(
|
||||
text: device.name ?? "",
|
||||
style: context.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 0,
|
||||
fontSize: 24,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -2,28 +2,42 @@ 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/features/devices/model/device_category_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class CustomSwitch extends StatelessWidget {
|
||||
const CustomSwitch({super.key, required this.category});
|
||||
const CustomSwitch({super.key, this.category, this.device})
|
||||
: assert(category != null || device != null);
|
||||
|
||||
final DevicesCategoryModel category;
|
||||
final DevicesCategoryModel? category;
|
||||
|
||||
final DeviceModel? device;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||
builder: (context, state) {
|
||||
bool? status;
|
||||
if (device != null) {
|
||||
status = device!.status;
|
||||
} else if (category != null) {
|
||||
status = category!.devicesStatus;
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
DevicesCubit.get(context).changeCategorySwitchValue(category);
|
||||
if (device != null) {
|
||||
DevicesCubit.get(context).turnOnOffDevice(device!);
|
||||
} else if (category != null) {
|
||||
DevicesCubit.get(context).changeCategorySwitchValue(category!);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 45.0,
|
||||
height: 28.0,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24.0),
|
||||
color: category.devicesStatus != null
|
||||
? category.devicesStatus!
|
||||
color: status != null
|
||||
? status
|
||||
? ColorsManager.primaryColor
|
||||
: const Color(0xFFD9D9D9)
|
||||
: const Color(0xFFD9D9D9),
|
||||
@ -39,8 +53,8 @@ class CustomSwitch extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: Container(
|
||||
alignment: category.devicesStatus != null
|
||||
? category.devicesStatus!
|
||||
alignment: status != null
|
||||
? status
|
||||
? Alignment.centerRight
|
||||
: Alignment.centerLeft
|
||||
: Alignment.centerLeft,
|
||||
@ -49,8 +63,8 @@ class CustomSwitch extends StatelessWidget {
|
||||
height: 20.0,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: category.devicesStatus != null
|
||||
? category.devicesStatus!
|
||||
color: status != null
|
||||
? status
|
||||
? ColorsManager.primaryColor
|
||||
: Colors.grey
|
||||
: Colors.grey,
|
||||
|
@ -51,7 +51,9 @@ class Assets {
|
||||
static const String imagesAutomation = 'assets/images/automation.jpg';
|
||||
static const String imagesBackground = 'assets/images/Background.png';
|
||||
static const String imagesBlackLogo = 'assets/images/black-logo.png';
|
||||
static const String imagesBlind = 'assets/images/blind.png';
|
||||
static const String imagesBoxEmpty = 'assets/images/box-empty.jpg';
|
||||
static const String imagesCurtain = 'assets/images/curtain.png';
|
||||
static const String imagesLogoHorizontal =
|
||||
'assets/images/logo_horizontal.png';
|
||||
static const String imagesTestDash = 'assets/images/test_dash.png';
|
||||
|
@ -21,17 +21,7 @@ class HTTPService {
|
||||
receiveTimeout: const Duration(milliseconds: 60000),
|
||||
),
|
||||
);
|
||||
// (client.httpClientAdapter as IOHttpClientAdapter).createHttpClient = () {
|
||||
// client. = (X509Certificate cert, String host, int port) {
|
||||
// // TODO add SSL certificate
|
||||
// // if(cert.pem == certificateString){ // Verify the certificate
|
||||
// // return true;
|
||||
// // }
|
||||
// // return false;
|
||||
// return true;
|
||||
// };
|
||||
// return client;
|
||||
// };
|
||||
|
||||
client.interceptors.add(locator<HTTPInterceptor>());
|
||||
return client;
|
||||
}
|
||||
|
@ -10,3 +10,12 @@ abstract class Constants {
|
||||
|
||||
static const double defaultPadding = 16;
|
||||
}
|
||||
|
||||
enum DeviceType {
|
||||
AC,
|
||||
Lights,
|
||||
Door,
|
||||
Curtain,
|
||||
Screens,
|
||||
Gateway,
|
||||
}
|
||||
|
Reference in New Issue
Block a user