Updated the curtain desgin and removed unused code

This commit is contained in:
Abdullah Alassaf
2024-10-06 22:30:28 +03:00
parent 4b45257aff
commit 2d54d52061
18 changed files with 556 additions and 849 deletions

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,32 @@
<svg width="33" height="319" viewBox="0 0 33 319" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M32.675 6.07198V318.219L30.535 319V5.29102L32.675 6.07198Z" fill="url(#paint0_linear_4847_2158)"/>
<path d="M0.525162 315.619L30.5352 319V5.29102L0.525162 8.68132V315.619Z" fill="url(#paint1_linear_4847_2158)"/>
<path d="M17.9751 0.0722656H13.0851V7.5144C13.0851 8.50669 13.9651 9.31522 15.0451 9.31522H16.0151C17.0951 9.31522 17.9751 8.50669 17.9751 7.5144V0.0722656Z" fill="url(#paint2_linear_4847_2158)"/>
<defs>
<linearGradient id="paint0_linear_4847_2158" x1="82.145" y1="20.5612" x2="-9.30122" y2="323.172" gradientUnits="userSpaceOnUse">
<stop stop-color="#E9E9E9"/>
<stop offset="0.26" stop-color="#E4E4E4"/>
<stop offset="0.51" stop-color="#D8D8D8"/>
<stop offset="0.77" stop-color="#C4C4C4"/>
<stop offset="0.78" stop-color="#C4C4C4"/>
<stop offset="1" stop-color="#C6C6C6"/>
</linearGradient>
<linearGradient id="paint1_linear_4847_2158" x1="30.5352" y1="-18.0001" x2="0.525162" y2="-18.0001" gradientUnits="userSpaceOnUse">
<stop stop-color="#F5F5F5"/>
<stop offset="0.22" stop-color="#F0F0F0"/>
<stop offset="0.45" stop-color="#E4E4E4"/>
<stop offset="0.67" stop-color="#D0D0D0"/>
<stop offset="0.78" stop-color="#C4C4C4"/>
<stop offset="1" stop-color="#C6C6C6"/>
</linearGradient>
<linearGradient id="paint2_linear_4847_2158" x1="17.9751" y1="-18.0002" x2="13.0851" y2="-18.0002" gradientUnits="userSpaceOnUse">
<stop stop-color="#C4C4C4"/>
<stop offset="0.41" stop-color="#F8F8F8"/>
<stop offset="0.49" stop-color="#F0F0F0"/>
<stop offset="0.6" stop-color="#DCDCDC"/>
<stop offset="0.75" stop-color="#BABABA"/>
<stop offset="0.79" stop-color="#AEAEAE"/>
<stop offset="1" stop-color="#BEBEBE"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -24,9 +24,7 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
on<PauseCurtain>(_onPauseCurtain); on<PauseCurtain>(_onPauseCurtain);
} }
Future<void> _onOpenCurtain( Future<void> _onOpenCurtain(OpenCurtain event, Emitter<CurtainState> emit) async {
OpenCurtain event,
Emitter<CurtainState> emit) async {
isMoving = true; isMoving = true;
while (openPercentage < 100.0) { while (openPercentage < 100.0) {
if (state is CurtainsClosing) { if (state is CurtainsClosing) {
@ -48,7 +46,7 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
_pauseCurtain(emit); _pauseCurtain(emit);
} }
}); });
if (openPercentage >=100.0) { if (openPercentage >= 100.0) {
await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: curtainId, deviceId: curtainId,
@ -73,8 +71,7 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
} }
} }
Future<void> _onCloseCurtain( Future<void> _onCloseCurtain(CloseCurtain event, Emitter<CurtainState> emit) async {
CloseCurtain event, Emitter<CurtainState> emit) async {
isMoving = true; isMoving = true;
while (openPercentage > 0.0) { while (openPercentage > 0.0) {
if (state is CurtainsOpening) { if (state is CurtainsOpening) {
@ -121,8 +118,7 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
} }
} }
Future<void> _onPauseCurtain( Future<void> _onPauseCurtain(PauseCurtain event, Emitter<CurtainState> emit) async {
PauseCurtain event, Emitter<CurtainState> emit) async {
_pauseCurtain(emit); _pauseCurtain(emit);
await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
@ -132,7 +128,7 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
), ),
curtainId, curtainId,
); );
await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: curtainId, deviceId: curtainId,
code: 'percent_control', code: 'percent_control',
@ -151,9 +147,6 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
)); ));
} }
void _fetchStatus(InitCurtain event, Emitter<CurtainState> emit) async { void _fetchStatus(InitCurtain event, Emitter<CurtainState> emit) async {
try { try {
emit(CurtainLoadingState()); emit(CurtainLoadingState());
@ -166,10 +159,9 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
// Get the open percentage from the response // Get the open percentage from the response
openPercentage = double.tryParse(statusModelList[1].value.toString())!; openPercentage = double.tryParse(statusModelList[1].value.toString())!;
// Calculate curtain width and blind height based on the open percentage // Calculate curtain width and blind height based on the open percentage
if (openPercentage != null) { curtainWidth = 270 - (openPercentage / 100) * curtainOpeningSpace;
curtainWidth = 270 - (openPercentage / 100) * curtainOpeningSpace; blindHeight = 310 - (openPercentage / 100) * blindOpeningSpace;
blindHeight = 310 - (openPercentage / 100) * blindOpeningSpace;
}
emit(CurtainsOpening( emit(CurtainsOpening(
curtainWidth: curtainWidth, curtainWidth: curtainWidth,
blindHeight: blindHeight, blindHeight: blindHeight,
@ -180,5 +172,4 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
return; return;
} }
} }
} }

View File

@ -54,8 +54,7 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
batteryPercentage: 0, batteryPercentage: 0,
); );
void _fetchStatus( void _fetchStatus(GarageDoorInitial event, Emitter<GarageDoorSensorState> emit) async {
GarageDoorInitial event, Emitter<GarageDoorSensorState> emit) async {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
try { try {
var response = await DevicesAPI.getDeviceStatus(GDId); var response = await DevicesAPI.getDeviceStatus(GDId);
@ -77,8 +76,8 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
void _toggleClosingReminder(ToggleClosingReminderEvent event, void _toggleClosingReminder(
Emitter<GarageDoorSensorState> emit) async { ToggleClosingReminderEvent event, Emitter<GarageDoorSensorState> emit) async {
emit(LoadingNewSate(doorSensor: deviceStatus)); emit(LoadingNewSate(doorSensor: deviceStatus));
try { try {
closingReminder = event.isClosingReminderEnabled; closingReminder = event.isClosingReminderEnabled;
@ -96,8 +95,7 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
void _toggleDoorAlarm( void _toggleDoorAlarm(ToggleDoorAlarmEvent event, Emitter<GarageDoorSensorState> emit) async {
ToggleDoorAlarmEvent event, Emitter<GarageDoorSensorState> emit) async {
emit(LoadingNewSate(doorSensor: deviceStatus)); emit(LoadingNewSate(doorSensor: deviceStatus));
try { try {
doorAlarm = event.isDoorAlarmEnabled; doorAlarm = event.isDoorAlarmEnabled;
@ -115,8 +113,7 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
DeviceReport recordGroups = DeviceReport recordGroups = DeviceReport(startTime: '0', endTime: '0', data: []);
DeviceReport(startTime: '0', endTime: '0', data: []);
Future<void> fetchLogsForLastMonth( Future<void> fetchLogsForLastMonth(
ReportLogsInitial event, Emitter<GarageDoorSensorState> emit) async { ReportLogsInitial event, Emitter<GarageDoorSensorState> emit) async {
@ -144,16 +141,14 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
_listenToChanges() { _listenToChanges() {
try { try {
DatabaseReference ref = DatabaseReference ref = FirebaseDatabase.instance.ref('device-status/$GDId');
FirebaseDatabase.instance.ref('device-status/$GDId');
Stream<DatabaseEvent> stream = ref.onValue; Stream<DatabaseEvent> stream = ref.onValue;
stream.listen((DatabaseEvent event) async { stream.listen((DatabaseEvent event) async {
if (_timer != null) { if (_timer != null) {
await Future.delayed(const Duration(seconds: 2)); await Future.delayed(const Duration(seconds: 2));
} }
Map<dynamic, dynamic> usersMap = Map<dynamic, dynamic> usersMap = event.snapshot.value as Map<dynamic, dynamic>;
event.snapshot.value as Map<dynamic, dynamic>;
List<StatusModel> statusList = []; List<StatusModel> statusList = [];
usersMap['status'].forEach((element) { usersMap['status'].forEach((element) {
statusList.add(StatusModel(code: element['code'], value: true)); statusList.add(StatusModel(code: element['code'], value: true));
@ -227,8 +222,7 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
deviceId: GDId, deviceId: GDId,
); );
List<dynamic> jsonData = response; List<dynamic> jsonData = response;
listSchedule = listSchedule = jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
String errorMessage = errorData['message']; String errorMessage = errorData['message'];
@ -238,13 +232,12 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
int? getTimeStampWithoutSeconds(DateTime? dateTime) { int? getTimeStampWithoutSeconds(DateTime? dateTime) {
if (dateTime == null) return null; if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month, DateTime dateTimeWithoutSeconds =
dateTime.day, dateTime.hour, dateTime.minute); DateTime(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute);
return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000; return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000;
} }
Future toggleChange( Future toggleChange(ToggleScheduleEvent event, Emitter<GarageDoorSensorState> emit) async {
ToggleScheduleEvent event, Emitter<GarageDoorSensorState> emit) async {
try { try {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
final response = await DevicesAPI.changeSchedule( final response = await DevicesAPI.changeSchedule(
@ -262,8 +255,7 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
Future deleteSchedule( Future deleteSchedule(DeleteScheduleEvent event, Emitter<GarageDoorSensorState> emit) async {
DeleteScheduleEvent event, Emitter<GarageDoorSensorState> emit) async {
try { try {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
final response = await DevicesAPI.deleteSchedule( final response = await DevicesAPI.deleteSchedule(
@ -282,15 +274,13 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
void toggleSelectedIndex( void toggleSelectedIndex(ToggleSelectedEvent event, Emitter<GarageDoorSensorState> emit) {
ToggleSelectedEvent event, Emitter<GarageDoorSensorState> emit) {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
selectedTabIndex = event.index; selectedTabIndex = event.index;
emit(ChangeSlidingSegmentState(value: selectedTabIndex)); emit(ChangeSlidingSegmentState(value: selectedTabIndex));
} }
void toggleCreateSchedule( void toggleCreateSchedule(ToggleCreateScheduleEvent event, Emitter<GarageDoorSensorState> emit) {
ToggleCreateScheduleEvent event, Emitter<GarageDoorSensorState> emit) {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
createSchedule = !createSchedule; createSchedule = !createSchedule;
selectedDays.clear(); selectedDays.clear();
@ -307,16 +297,13 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
int secondSelected = 0; int secondSelected = 0;
bool toggleDoor = false; bool toggleDoor = false;
Future<void> selectSeconds( Future<void> selectSeconds(SelectSecondsEvent event, Emitter<GarageDoorSensorState> emit) async {
SelectSecondsEvent event, Emitter<GarageDoorSensorState> emit) async {
try { try {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
secondSelected = event.seconds; secondSelected = event.seconds;
final response = await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: GDId, code: 'tr_timecon', value: secondSelected), GDId);
deviceId: GDId, code: 'tr_timecon', value: secondSelected),
GDId);
emit(UpdateState(garageSensor: deviceStatus)); emit(UpdateState(garageSensor: deviceStatus));
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
@ -325,16 +312,13 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
openCloseGarageDoor( openCloseGarageDoor(ToggleDoorEvent event, Emitter<GarageDoorSensorState> emit) async {
ToggleDoorEvent event, Emitter<GarageDoorSensorState> emit) async {
emit(GarageDoorLoadingState()); emit(GarageDoorLoadingState());
try { try {
toggleDoor = !event.toggle; toggleDoor = !event.toggle;
final response = await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: GDId, code: 'switch_1', value: toggleDoor), GDId);
deviceId: GDId, code: 'switch_1', value: toggleDoor), add(const GarageDoorInitial());
GDId);
add(GarageDoorInitial());
emit(UpdateState(garageSensor: deviceStatus)); emit(UpdateState(garageSensor: deviceStatus));
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
@ -343,21 +327,18 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
void _setCounterValue( void _setCounterValue(SetCounterValue event, Emitter<GarageDoorSensorState> emit) async {
SetCounterValue event, Emitter<GarageDoorSensorState> emit) async {
emit(LoadingNewSate(doorSensor: deviceStatus)); emit(LoadingNewSate(doorSensor: deviceStatus));
int seconds = 0; int seconds = 0;
try { try {
seconds = event.duration.inSeconds; seconds = event.duration.inSeconds;
final response = await DevicesAPI.controlDevice( final response = await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: GDId, code: 'countdown_1', value: seconds), GDId);
deviceId: GDId, code: 'countdown_1', value: seconds),
GDId);
if (response['success'] ?? false) { if (response['success'] ?? false) {
deviceStatus.countdown1 = seconds; deviceStatus.countdown1 = seconds;
} else { } else {
emit(GarageDoorFailedState(errorMessage: 'Something went wrong')); emit(const GarageDoorFailedState(errorMessage: 'Something went wrong'));
return; return;
} }
} catch (e) { } catch (e) {
@ -372,8 +353,7 @@ class GarageDoorBloc extends Bloc<GarageDoorEvent, GarageDoorSensorState> {
} }
} }
void _getCounterValue( void _getCounterValue(GetCounterEvent event, Emitter<GarageDoorSensorState> emit) async {
GetCounterEvent event, Emitter<GarageDoorSensorState> emit) async {
emit(LoadingInitialState()); emit(LoadingInitialState());
try { try {
var response = await DevicesAPI.getDeviceStatus(GDId); var response = await DevicesAPI.getDeviceStatus(GDId);

View File

@ -29,8 +29,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
bool oneTouchGroup = false; bool oneTouchGroup = false;
List<DeviceModel> devicesList = []; List<DeviceModel> devicesList = [];
OneTouchBloc({required this.oneTouchId, required this.switchCode}) OneTouchBloc({required this.oneTouchId, required this.switchCode}) : super(InitialState()) {
: super(InitialState()) {
on<InitialEvent>(_fetchOneTouchStatus); on<InitialEvent>(_fetchOneTouchStatus);
on<OneTouchUpdated>(_oneTouchUpdated); on<OneTouchUpdated>(_oneTouchUpdated);
on<ChangeFirstSwitchStatusEvent>(_changeFirstSwitch); on<ChangeFirstSwitchStatusEvent>(_changeFirstSwitch);
@ -53,8 +52,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
on<ChangeStatusEvent>(_changeStatus); on<ChangeStatusEvent>(_changeStatus);
} }
void _fetchOneTouchStatus( void _fetchOneTouchStatus(InitialEvent event, Emitter<OneTouchState> emit) async {
InitialEvent event, Emitter<OneTouchState> emit) async {
emit(LoadingInitialState()); emit(LoadingInitialState());
try { try {
var response = await DevicesAPI.getDeviceStatus(oneTouchId); var response = await DevicesAPI.getDeviceStatus(oneTouchId);
@ -73,21 +71,18 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
_listenToChanges() { _listenToChanges() {
try { try {
DatabaseReference ref = DatabaseReference ref = FirebaseDatabase.instance.ref('device-status/$oneTouchId');
FirebaseDatabase.instance.ref('device-status/$oneTouchId');
Stream<DatabaseEvent> stream = ref.onValue; Stream<DatabaseEvent> stream = ref.onValue;
stream.listen((DatabaseEvent event) async { stream.listen((DatabaseEvent event) async {
if (_timer != null) { if (_timer != null) {
await Future.delayed(const Duration(seconds: 2)); await Future.delayed(const Duration(seconds: 2));
} }
Map<dynamic, dynamic> usersMap = Map<dynamic, dynamic> usersMap = event.snapshot.value as Map<dynamic, dynamic>;
event.snapshot.value as Map<dynamic, dynamic>;
List<StatusModel> statusList = []; List<StatusModel> statusList = [];
usersMap['status'].forEach((element) { usersMap['status'].forEach((element) {
statusList statusList.add(StatusModel(code: element['code'], value: element['value']));
.add(StatusModel(code: element['code'], value: element['value']));
}); });
deviceStatus = OneTouchModel.fromJson(statusList); deviceStatus = OneTouchModel.fromJson(statusList);
@ -102,8 +97,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
emit(UpdateState(oneTouchModel: deviceStatus)); emit(UpdateState(oneTouchModel: deviceStatus));
} }
void _changeFirstSwitch( void _changeFirstSwitch(ChangeFirstSwitchStatusEvent event, Emitter<OneTouchState> emit) async {
ChangeFirstSwitchStatusEvent event, Emitter<OneTouchState> emit) async {
emit(LoadingNewSate(oneTouchModel: deviceStatus)); emit(LoadingNewSate(oneTouchModel: deviceStatus));
try { try {
deviceStatus.firstSwitch = !event.value; deviceStatus.firstSwitch = !event.value;
@ -128,20 +122,17 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
} }
} }
void _changeSliding( void _changeSliding(ChangeSlidingSegment event, Emitter<OneTouchState> emit) async {
ChangeSlidingSegment event, Emitter<OneTouchState> emit) async {
emit(ChangeSlidingSegmentState(value: event.value)); emit(ChangeSlidingSegmentState(value: event.value));
} }
void _setCounterValue( void _setCounterValue(SetCounterValue event, Emitter<OneTouchState> emit) async {
SetCounterValue event, Emitter<OneTouchState> emit) async {
emit(LoadingNewSate(oneTouchModel: deviceStatus)); emit(LoadingNewSate(oneTouchModel: deviceStatus));
int seconds = 0; int seconds = 0;
try { try {
seconds = event.duration.inSeconds; seconds = event.duration.inSeconds;
final response = await DevicesAPI.controlDevice( final response = await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: oneTouchId, code: event.deviceCode, value: seconds),
deviceId: oneTouchId, code: event.deviceCode, value: seconds),
oneTouchId); oneTouchId);
if (response['success'] ?? false) { if (response['success'] ?? false) {
@ -164,8 +155,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
} }
} }
void _getCounterValue( void _getCounterValue(GetCounterEvent event, Emitter<OneTouchState> emit) async {
GetCounterEvent event, Emitter<OneTouchState> emit) async {
emit(LoadingInitialState()); emit(LoadingInitialState());
try { try {
var response = await DevicesAPI.getDeviceStatus(oneTouchId); var response = await DevicesAPI.getDeviceStatus(oneTouchId);
@ -254,8 +244,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
deviceId: oneTouchId, deviceId: oneTouchId,
); );
List<dynamic> jsonData = response; List<dynamic> jsonData = response;
listSchedule = listSchedule = jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
emit(InitialState()); emit(InitialState());
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
@ -266,13 +255,12 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
int? getTimeStampWithoutSeconds(DateTime? dateTime) { int? getTimeStampWithoutSeconds(DateTime? dateTime) {
if (dateTime == null) return null; if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month, DateTime dateTimeWithoutSeconds =
dateTime.day, dateTime.hour, dateTime.minute); DateTime(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute);
return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000; return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000;
} }
Future toggleChange( Future toggleChange(ToggleScheduleEvent event, Emitter<OneTouchState> emit) async {
ToggleScheduleEvent event, Emitter<OneTouchState> emit) async {
try { try {
emit(LoadingInitialState()); emit(LoadingInitialState());
final response = await DevicesAPI.changeSchedule( final response = await DevicesAPI.changeSchedule(
@ -291,8 +279,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
} }
} }
Future deleteSchedule( Future deleteSchedule(DeleteScheduleEvent event, Emitter<OneTouchState> emit) async {
DeleteScheduleEvent event, Emitter<OneTouchState> emit) async {
try { try {
emit(LoadingInitialState()); emit(LoadingInitialState());
final response = await DevicesAPI.deleteSchedule( final response = await DevicesAPI.deleteSchedule(
@ -312,8 +299,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
} }
} }
void toggleCreateSchedule( void toggleCreateSchedule(ToggleCreateScheduleEvent event, Emitter<OneTouchState> emit) {
ToggleCreateScheduleEvent event, Emitter<OneTouchState> emit) {
emit(LoadingInitialState()); emit(LoadingInitialState());
createSchedule = !createSchedule; createSchedule = !createSchedule;
selectedDays.clear(); selectedDays.clear();
@ -342,8 +328,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
int selectedTabIndex = 0; int selectedTabIndex = 0;
void toggleSelectedIndex( void toggleSelectedIndex(ToggleSelectedEvent event, Emitter<OneTouchState> emit) {
ToggleSelectedEvent event, Emitter<OneTouchState> emit) {
emit(LoadingInitialState()); emit(LoadingInitialState());
selectedTabIndex = event.index; selectedTabIndex = event.index;
emit(ChangeSlidingSegmentState(value: selectedTabIndex)); emit(ChangeSlidingSegmentState(value: selectedTabIndex));
@ -352,8 +337,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
List<GroupOneTouchModel> groupOneTouchList = []; List<GroupOneTouchModel> groupOneTouchList = [];
bool allSwitchesOn = true; bool allSwitchesOn = true;
void _fetchOneTouchWizardStatus( void _fetchOneTouchWizardStatus(InitialWizardEvent event, Emitter<OneTouchState> emit) async {
InitialWizardEvent event, Emitter<OneTouchState> emit) async {
emit(LoadingInitialState()); emit(LoadingInitialState());
try { try {
devicesList = []; devicesList = [];
@ -363,8 +347,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
HomeCubit.getInstance().selectedSpace?.id ?? '', '1GT'); HomeCubit.getInstance().selectedSpace?.id ?? '', '1GT');
for (int i = 0; i < devicesList.length; i++) { for (int i = 0; i < devicesList.length; i++) {
var response = var response = await DevicesAPI.getDeviceStatus(devicesList[i].uuid ?? '');
await DevicesAPI.getDeviceStatus(devicesList[i].uuid ?? '');
List<StatusModel> statusModelList = []; List<StatusModel> statusModelList = [];
for (var status in response['status']) { for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status)); statusModelList.add(StatusModel.fromJson(status));
@ -385,16 +368,15 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
return true; return true;
}); });
} }
emit(UpdateGroupState( emit(UpdateGroupState(oneTouchList: groupOneTouchList, allSwitches: allSwitchesOn));
oneTouchList: groupOneTouchList, allSwitches: allSwitchesOn));
} catch (e) { } catch (e) {
emit(FailedState(error: e.toString())); emit(FailedState(error: e.toString()));
return; return;
} }
} }
void _changeFirstWizardSwitch(ChangeFirstWizardSwitchStatusEvent event, void _changeFirstWizardSwitch(
Emitter<OneTouchState> emit) async { ChangeFirstWizardSwitchStatusEvent event, Emitter<OneTouchState> emit) async {
emit(LoadingNewSate(oneTouchModel: deviceStatus)); emit(LoadingNewSate(oneTouchModel: deviceStatus));
try { try {
bool allSwitchesValue = true; bool allSwitchesValue = true;
@ -412,8 +394,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
value: !event.value, value: !event.value,
); );
emit(UpdateGroupState( emit(UpdateGroupState(oneTouchList: groupOneTouchList, allSwitches: allSwitchesValue));
oneTouchList: groupOneTouchList, allSwitches: allSwitchesValue));
if (!response['success']) { if (!response['success']) {
add(InitialEvent(groupScreen: oneTouchGroup)); add(InitialEvent(groupScreen: oneTouchGroup));
} }
@ -431,12 +412,10 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
} }
// Emit the state with updated values // Emit the state with updated values
emit( emit(UpdateGroupState(oneTouchList: groupOneTouchList, allSwitches: true));
UpdateGroupState(oneTouchList: groupOneTouchList, allSwitches: true));
// Get a list of all device IDs // Get a list of all device IDs
List<String> allDeviceIds = List<String> allDeviceIds = groupOneTouchList.map((device) => device.deviceId).toList();
groupOneTouchList.map((device) => device.deviceId).toList();
// First call for switch_1 // First call for switch_1
final response1 = await DevicesAPI.deviceBatchController( final response1 = await DevicesAPI.deviceBatchController(
@ -473,12 +452,10 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
} }
// Emit the state with updated values // Emit the state with updated values
emit(UpdateGroupState( emit(UpdateGroupState(oneTouchList: groupOneTouchList, allSwitches: false));
oneTouchList: groupOneTouchList, allSwitches: false));
// Get a list of all device IDs // Get a list of all device IDs
List<String> allDeviceIds = List<String> allDeviceIds = groupOneTouchList.map((device) => device.deviceId).toList();
groupOneTouchList.map((device) => device.deviceId).toList();
// First call for switch_1 // First call for switch_1
final response1 = await DevicesAPI.deviceBatchController( final response1 = await DevicesAPI.deviceBatchController(
@ -508,40 +485,38 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
String statusSelected = ''; String statusSelected = '';
String optionSelected = ''; String optionSelected = '';
Future<void> _changeStatus( Future<void> _changeStatus(ChangeStatusEvent event, Emitter<OneTouchState> emit) async {
ChangeStatusEvent event, Emitter<OneTouchState> emit) async { try {
try {
emit(LoadingInitialState()); emit(LoadingInitialState());
final Map<String, Map<String, String>> controlMap = { final Map<String, Map<String, String>> controlMap = {
"relay_status": { "relay_status": {
'Power On': 'power_on', 'Power On': 'power_on',
'Power Off': 'power_off', 'Power Off': 'power_off',
'Restart Memory': 'last', 'Restart Memory': 'last',
}, },
"light_mode": { "light_mode": {
'Off': 'none', 'Off': 'none',
'On/Off Status': 'relay', 'On/Off Status': 'relay',
'Switch Position': 'pos', 'Switch Position': 'pos',
}, },
"relay_status_1": { "relay_status_1": {
'Power On': 'power_on', 'Power On': 'power_on',
'Power Off': 'power_off', 'Power Off': 'power_off',
'Restart Memory': 'last', 'Restart Memory': 'last',
}, },
}; };
final selectedControl = controlMap[optionSelected]?[statusSelected]; final selectedControl = controlMap[optionSelected]?[statusSelected];
if (selectedControl != null) { if (selectedControl != null) {
await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: oneTouchId, code: optionSelected, value: selectedControl),
deviceId: oneTouchId, code: optionSelected, value: selectedControl), oneTouchId,
oneTouchId, );
); } else {
} else { print('Invalid statusSelected or optionSelected');
print('Invalid statusSelected or optionSelected'); }
} } on DioException catch (e) {
} on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
String errorMessage = errorData['message']; String errorMessage = errorData['message'];
emit(FailedState(error: errorMessage.toString())); emit(FailedState(error: errorMessage.toString()));

View File

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:firebase_database/firebase_database.dart'; import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart'; import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_event.dart'; import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_event.dart';
@ -39,8 +38,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
List<GroupThreeTouchModel> groupThreeTouchList = []; List<GroupThreeTouchModel> groupThreeTouchList = [];
bool allSwitchesOn = true; bool allSwitchesOn = true;
ThreeTouchBloc({required this.threeTouchId, required this.switchCode}) ThreeTouchBloc({required this.threeTouchId, required this.switchCode}) : super(InitialState()) {
: super(InitialState()) {
on<InitialEvent>(_fetchThreeTouchStatus); on<InitialEvent>(_fetchThreeTouchStatus);
on<ThreeTouchUpdated>(_threeTouchUpdated); on<ThreeTouchUpdated>(_threeTouchUpdated);
on<ChangeFirstSwitchStatusEvent>(_changeFirstSwitch); on<ChangeFirstSwitchStatusEvent>(_changeFirstSwitch);
@ -67,8 +65,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
on<ChangeStatusEvent>(_changeStatus); on<ChangeStatusEvent>(_changeStatus);
} }
void _fetchThreeTouchStatus( void _fetchThreeTouchStatus(InitialEvent event, Emitter<ThreeTouchState> emit) async {
InitialEvent event, Emitter<ThreeTouchState> emit) async {
emit(LoadingInitialState()); emit(LoadingInitialState());
try { try {
threeTouchGroup = event.groupScreen; threeTouchGroup = event.groupScreen;
@ -80,8 +77,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
HomeCubit.getInstance().selectedSpace?.id ?? '', '3GT'); HomeCubit.getInstance().selectedSpace?.id ?? '', '3GT');
for (int i = 0; i < devicesList.length; i++) { for (int i = 0; i < devicesList.length; i++) {
var response = var response = await DevicesAPI.getDeviceStatus(devicesList[i].uuid ?? '');
await DevicesAPI.getDeviceStatus(devicesList[i].uuid ?? '');
List<StatusModel> statusModelList = []; List<StatusModel> statusModelList = [];
for (var status in response['status']) { for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status)); statusModelList.add(StatusModel.fromJson(status));
@ -98,16 +94,13 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
if (groupThreeTouchList.isNotEmpty) { if (groupThreeTouchList.isNotEmpty) {
groupThreeTouchList.firstWhere((element) { groupThreeTouchList.firstWhere((element) {
if (!element.firstSwitch || if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
!element.secondSwitch ||
!element.thirdSwitch) {
allSwitchesOn = false; allSwitchesOn = false;
} }
return true; return true;
}); });
} }
emit(UpdateGroupState( emit(UpdateGroupState(threeTouchList: groupThreeTouchList, allSwitches: allSwitchesOn));
threeTouchList: groupThreeTouchList, allSwitches: allSwitchesOn));
} else { } else {
var response = await DevicesAPI.getDeviceStatus(threeTouchId); var response = await DevicesAPI.getDeviceStatus(threeTouchId);
List<StatusModel> statusModelList = []; List<StatusModel> statusModelList = [];
@ -126,21 +119,18 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
_listenToChanges() { _listenToChanges() {
try { try {
DatabaseReference ref = DatabaseReference ref = FirebaseDatabase.instance.ref('device-status/$threeTouchId');
FirebaseDatabase.instance.ref('device-status/$threeTouchId');
Stream<DatabaseEvent> stream = ref.onValue; Stream<DatabaseEvent> stream = ref.onValue;
stream.listen((DatabaseEvent event) async { stream.listen((DatabaseEvent event) async {
if (_timer != null) { if (_timer != null) {
await Future.delayed(const Duration(seconds: 2)); await Future.delayed(const Duration(seconds: 2));
} }
Map<dynamic, dynamic> usersMap = Map<dynamic, dynamic> usersMap = event.snapshot.value as Map<dynamic, dynamic>;
event.snapshot.value as Map<dynamic, dynamic>;
List<StatusModel> statusList = []; List<StatusModel> statusList = [];
usersMap['status'].forEach((element) { usersMap['status'].forEach((element) {
statusList statusList.add(StatusModel(code: element['code'], value: element['value']));
.add(StatusModel(code: element['code'], value: element['value']));
}); });
deviceStatus = ThreeTouchModel.fromJson(statusList); deviceStatus = ThreeTouchModel.fromJson(statusList);
@ -155,8 +145,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
emit(UpdateState(threeTouchModel: deviceStatus)); emit(UpdateState(threeTouchModel: deviceStatus));
} }
void _changeFirstSwitch( void _changeFirstSwitch(ChangeFirstSwitchStatusEvent event, Emitter<ThreeTouchState> emit) async {
ChangeFirstSwitchStatusEvent event, Emitter<ThreeTouchState> emit) async {
emit(LoadingNewSate(threeTouchModel: deviceStatus)); emit(LoadingNewSate(threeTouchModel: deviceStatus));
try { try {
if (threeTouchGroup) { if (threeTouchGroup) {
@ -165,15 +154,11 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
if (element.deviceId == event.deviceId) { if (element.deviceId == event.deviceId) {
element.firstSwitch = !event.value; element.firstSwitch = !event.value;
} }
if (!element.firstSwitch || if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
!element.secondSwitch ||
!element.thirdSwitch) {
allSwitchesValue = false; allSwitchesValue = false;
} }
}); });
emit(UpdateGroupState( emit(UpdateGroupState(threeTouchList: groupThreeTouchList, allSwitches: allSwitchesValue));
threeTouchList: groupThreeTouchList,
allSwitches: allSwitchesValue));
} else { } else {
deviceStatus.firstSwitch = !event.value; deviceStatus.firstSwitch = !event.value;
emit(UpdateState(threeTouchModel: deviceStatus)); emit(UpdateState(threeTouchModel: deviceStatus));
@ -200,8 +185,8 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
void _changeSecondSwitch(ChangeSecondSwitchStatusEvent event, void _changeSecondSwitch(
Emitter<ThreeTouchState> emit) async { ChangeSecondSwitchStatusEvent event, Emitter<ThreeTouchState> emit) async {
emit(LoadingNewSate(threeTouchModel: deviceStatus)); emit(LoadingNewSate(threeTouchModel: deviceStatus));
try { try {
if (threeTouchGroup) { if (threeTouchGroup) {
@ -210,15 +195,11 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
if (element.deviceId == event.deviceId) { if (element.deviceId == event.deviceId) {
element.secondSwitch = !event.value; element.secondSwitch = !event.value;
} }
if (!element.firstSwitch || if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
!element.secondSwitch ||
!element.thirdSwitch) {
allSwitchesValue = false; allSwitchesValue = false;
} }
}); });
emit(UpdateGroupState( emit(UpdateGroupState(threeTouchList: groupThreeTouchList, allSwitches: allSwitchesValue));
threeTouchList: groupThreeTouchList,
allSwitches: allSwitchesValue));
} else { } else {
deviceStatus.secondSwitch = !event.value; deviceStatus.secondSwitch = !event.value;
emit(UpdateState(threeTouchModel: deviceStatus)); emit(UpdateState(threeTouchModel: deviceStatus));
@ -244,8 +225,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
void _changeThirdSwitch( void _changeThirdSwitch(ChangeThirdSwitchStatusEvent event, Emitter<ThreeTouchState> emit) async {
ChangeThirdSwitchStatusEvent event, Emitter<ThreeTouchState> emit) async {
emit(LoadingNewSate(threeTouchModel: deviceStatus)); emit(LoadingNewSate(threeTouchModel: deviceStatus));
try { try {
if (threeTouchGroup) { if (threeTouchGroup) {
@ -254,15 +234,11 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
if (element.deviceId == event.deviceId) { if (element.deviceId == event.deviceId) {
element.thirdSwitch = !event.value; element.thirdSwitch = !event.value;
} }
if (!element.firstSwitch || if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
!element.secondSwitch ||
!element.thirdSwitch) {
allSwitchesValue = false; allSwitchesValue = false;
} }
}); });
emit(UpdateGroupState( emit(UpdateGroupState(threeTouchList: groupThreeTouchList, allSwitches: allSwitchesValue));
threeTouchList: groupThreeTouchList,
allSwitches: allSwitchesValue));
} else { } else {
deviceStatus.thirdSwitch = !event.value; deviceStatus.thirdSwitch = !event.value;
emit(UpdateState(threeTouchModel: deviceStatus)); emit(UpdateState(threeTouchModel: deviceStatus));
@ -301,21 +277,15 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
final response = await Future.wait([ final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeTouchId, deviceId: threeTouchId, code: 'switch_1', value: deviceStatus.firstSwitch),
code: 'switch_1',
value: deviceStatus.firstSwitch),
threeTouchId), threeTouchId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeTouchId, deviceId: threeTouchId, code: 'switch_2', value: deviceStatus.secondSwitch),
code: 'switch_2',
value: deviceStatus.secondSwitch),
threeTouchId), threeTouchId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeTouchId, deviceId: threeTouchId, code: 'switch_3', value: deviceStatus.thirdSwitch),
code: 'switch_3',
value: deviceStatus.thirdSwitch),
threeTouchId), threeTouchId),
]); ]);
@ -341,21 +311,15 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
final response = await Future.wait([ final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeTouchId, deviceId: threeTouchId, code: 'switch_1', value: deviceStatus.firstSwitch),
code: 'switch_1',
value: deviceStatus.firstSwitch),
threeTouchId), threeTouchId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeTouchId, deviceId: threeTouchId, code: 'switch_2', value: deviceStatus.secondSwitch),
code: 'switch_2',
value: deviceStatus.secondSwitch),
threeTouchId), threeTouchId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeTouchId, deviceId: threeTouchId, code: 'switch_3', value: deviceStatus.thirdSwitch),
code: 'switch_3',
value: deviceStatus.thirdSwitch),
threeTouchId), threeTouchId),
]); ]);
@ -377,28 +341,21 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
groupThreeTouchList[i].secondSwitch = true; groupThreeTouchList[i].secondSwitch = true;
groupThreeTouchList[i].thirdSwitch = true; groupThreeTouchList[i].thirdSwitch = true;
} }
emit(UpdateGroupState( emit(UpdateGroupState(threeTouchList: groupThreeTouchList, allSwitches: true));
threeTouchList: groupThreeTouchList, allSwitches: true));
for (int i = 0; i < groupThreeTouchList.length; i++) { for (int i = 0; i < groupThreeTouchList.length; i++) {
final response = await Future.wait([ final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeTouchList[i].deviceId, deviceId: groupThreeTouchList[i].deviceId, code: 'switch_1', value: true),
code: 'switch_1',
value: true),
groupThreeTouchList[i].deviceId), groupThreeTouchList[i].deviceId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeTouchList[i].deviceId, deviceId: groupThreeTouchList[i].deviceId, code: 'switch_2', value: true),
code: 'switch_2',
value: true),
groupThreeTouchList[i].deviceId), groupThreeTouchList[i].deviceId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeTouchList[i].deviceId, deviceId: groupThreeTouchList[i].deviceId, code: 'switch_3', value: true),
code: 'switch_3',
value: true),
groupThreeTouchList[i].deviceId), groupThreeTouchList[i].deviceId),
]); ]);
@ -414,8 +371,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
void _groupAllOff( void _groupAllOff(GroupAllOffEvent event, Emitter<ThreeTouchState> emit) async {
GroupAllOffEvent event, Emitter<ThreeTouchState> emit) async {
emit(LoadingNewSate(threeTouchModel: deviceStatus)); emit(LoadingNewSate(threeTouchModel: deviceStatus));
try { try {
for (int i = 0; i < groupThreeTouchList.length; i++) { for (int i = 0; i < groupThreeTouchList.length; i++) {
@ -423,28 +379,21 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
groupThreeTouchList[i].secondSwitch = false; groupThreeTouchList[i].secondSwitch = false;
groupThreeTouchList[i].thirdSwitch = false; groupThreeTouchList[i].thirdSwitch = false;
} }
emit(UpdateGroupState( emit(UpdateGroupState(threeTouchList: groupThreeTouchList, allSwitches: false));
threeTouchList: groupThreeTouchList, allSwitches: false));
for (int i = 0; i < groupThreeTouchList.length; i++) { for (int i = 0; i < groupThreeTouchList.length; i++) {
final response = await Future.wait([ final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeTouchList[i].deviceId, deviceId: groupThreeTouchList[i].deviceId, code: 'switch_1', value: false),
code: 'switch_1',
value: false),
groupThreeTouchList[i].deviceId), groupThreeTouchList[i].deviceId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeTouchList[i].deviceId, deviceId: groupThreeTouchList[i].deviceId, code: 'switch_2', value: false),
code: 'switch_2',
value: false),
groupThreeTouchList[i].deviceId), groupThreeTouchList[i].deviceId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeTouchList[i].deviceId, deviceId: groupThreeTouchList[i].deviceId, code: 'switch_3', value: false),
code: 'switch_3',
value: false),
groupThreeTouchList[i].deviceId), groupThreeTouchList[i].deviceId),
]); ]);
@ -460,20 +409,17 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
void _changeSliding( void _changeSliding(ChangeSlidingSegment event, Emitter<ThreeTouchState> emit) async {
ChangeSlidingSegment event, Emitter<ThreeTouchState> emit) async {
emit(ChangeSlidingSegmentState(value: event.value)); emit(ChangeSlidingSegmentState(value: event.value));
} }
void _setCounterValue( void _setCounterValue(SetCounterValue event, Emitter<ThreeTouchState> emit) async {
SetCounterValue event, Emitter<ThreeTouchState> emit) async {
emit(LoadingNewSate(threeTouchModel: deviceStatus)); emit(LoadingNewSate(threeTouchModel: deviceStatus));
int seconds = 0; int seconds = 0;
try { try {
seconds = event.duration.inSeconds; seconds = event.duration.inSeconds;
final response = await DevicesAPI.controlDevice( final response = await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: threeTouchId, code: event.deviceCode, value: seconds),
deviceId: threeTouchId, code: event.deviceCode, value: seconds),
threeTouchId); threeTouchId);
if (response['success'] ?? false) { if (response['success'] ?? false) {
@ -500,8 +446,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
void _getCounterValue( void _getCounterValue(GetCounterEvent event, Emitter<ThreeTouchState> emit) async {
GetCounterEvent event, Emitter<ThreeTouchState> emit) async {
emit(LoadingInitialState()); emit(LoadingInitialState());
try { try {
var response = await DevicesAPI.getDeviceStatus(threeTouchId); var response = await DevicesAPI.getDeviceStatus(threeTouchId);
@ -611,8 +556,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
deviceId: threeTouchId, deviceId: threeTouchId,
); );
List<dynamic> jsonData = response; List<dynamic> jsonData = response;
listSchedule = listSchedule = jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
jsonData.map((item) => ScheduleModel.fromJson(item)).toList();
emit(InitialState()); emit(InitialState());
} on DioException catch (e) { } on DioException catch (e) {
final errorData = e.response!.data; final errorData = e.response!.data;
@ -623,13 +567,12 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
int? getTimeStampWithoutSeconds(DateTime? dateTime) { int? getTimeStampWithoutSeconds(DateTime? dateTime) {
if (dateTime == null) return null; if (dateTime == null) return null;
DateTime dateTimeWithoutSeconds = DateTime(dateTime.year, dateTime.month, DateTime dateTimeWithoutSeconds =
dateTime.day, dateTime.hour, dateTime.minute); DateTime(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute);
return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000; return dateTimeWithoutSeconds.millisecondsSinceEpoch ~/ 1000;
} }
Future toggleChange( Future toggleChange(ToggleScheduleEvent event, Emitter<ThreeTouchState> emit) async {
ToggleScheduleEvent event, Emitter<ThreeTouchState> emit) async {
try { try {
emit(LoadingInitialState()); emit(LoadingInitialState());
final response = await DevicesAPI.changeSchedule( final response = await DevicesAPI.changeSchedule(
@ -648,8 +591,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
Future deleteSchedule( Future deleteSchedule(DeleteScheduleEvent event, Emitter<ThreeTouchState> emit) async {
DeleteScheduleEvent event, Emitter<ThreeTouchState> emit) async {
try { try {
emit(LoadingInitialState()); emit(LoadingInitialState());
final response = await DevicesAPI.deleteSchedule( final response = await DevicesAPI.deleteSchedule(
@ -669,15 +611,13 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
} }
} }
void toggleSelectedIndex( void toggleSelectedIndex(ToggleSelectedEvent event, Emitter<ThreeTouchState> emit) {
ToggleSelectedEvent event, Emitter<ThreeTouchState> emit) {
emit(LoadingInitialState()); emit(LoadingInitialState());
selectedTabIndex = event.index; selectedTabIndex = event.index;
emit(ChangeSlidingSegmentState(value: selectedTabIndex)); emit(ChangeSlidingSegmentState(value: selectedTabIndex));
} }
void toggleCreateSchedule( void toggleCreateSchedule(ToggleCreateScheduleEvent event, Emitter<ThreeTouchState> emit) {
ToggleCreateScheduleEvent event, Emitter<ThreeTouchState> emit) {
emit(LoadingInitialState()); emit(LoadingInitialState());
createSchedule = !createSchedule; createSchedule = !createSchedule;
selectedDays.clear(); selectedDays.clear();
@ -695,8 +635,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
String statusSelected = ''; String statusSelected = '';
String optionSelected = ''; String optionSelected = '';
Future<void> _changeStatus( Future<void> _changeStatus(ChangeStatusEvent event, Emitter<ThreeTouchState> emit) async {
ChangeStatusEvent event, Emitter<ThreeTouchState> emit) async {
try { try {
emit(LoadingInitialState()); emit(LoadingInitialState());
final Map<String, Map<String, String>> controlMap = { final Map<String, Map<String, String>> controlMap = {
@ -730,10 +669,7 @@ class ThreeTouchBloc extends Bloc<ThreeTouchEvent, ThreeTouchState> {
final selectedControl = controlMap[optionSelected]?[statusSelected]; final selectedControl = controlMap[optionSelected]?[statusSelected];
if (selectedControl != null) { if (selectedControl != null) {
await DevicesAPI.controlDevice( await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(deviceId: threeTouchId, code: optionSelected, value: selectedControl),
deviceId: threeTouchId,
code: optionSelected,
value: selectedControl),
threeTouchId, threeTouchId,
); );
} else { } else {

View File

@ -36,11 +36,11 @@ class CurtainView extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Stack( Stack(
alignment: Alignment.centerLeft, alignment: Alignment.center,
children: [ children: [
Container( Container(
height: 340, height: MediaQuery.sizeOf(context).height * 0.5,
width: 365, width: MediaQuery.sizeOf(context).width,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: AssetImage(
@ -49,42 +49,85 @@ class CurtainView extends StatelessWidget {
), ),
), ),
), ),
Padding( Container(
padding: const EdgeInsets.all(40), padding: const EdgeInsets.only(top: 40),
child: AnimatedContainer( child: Column(
duration: const Duration(milliseconds: 200), children: [
curve: Curves.linear, SvgPicture.asset(
height: 310, Assets.assetsIconsCurtainsIconCurtainHolder,
width: curtainWidth, width: MediaQuery.sizeOf(context).width * 0.8,
child: Stack( ),
children: List.generate( SizedBox(
10, width: MediaQuery.sizeOf(context).width * 0.8,
(index) { child: Row(
double spacing = curtainWidth / 9; mainAxisAlignment: MainAxisAlignment.spaceBetween,
double leftMostPosition = index * spacing; children: [
return AnimatedPositioned( Container(
duration: const Duration(milliseconds: 200), padding: const EdgeInsets.only(bottom: 40, left: 8),
curve: Curves.linear, child: AnimatedContainer(
left: leftMostPosition, duration: const Duration(milliseconds: 200),
child: SizedBox( curve: Curves.linear,
height: 320, height: MediaQuery.sizeOf(context).height * 0.4,
width: 32, width: curtainWidth / 2,
child: SvgPicture.asset( child: Stack(
Assets.assetsIconsCurtainsIconVerticalBlade, children: List.generate(
fit: BoxFit.fill, 4,
(index) {
double spacing = curtainWidth / 8;
double leftMostPosition = index * spacing;
return AnimatedPositioned(
duration: const Duration(milliseconds: 200),
curve: Curves.linear,
left: leftMostPosition,
child: SizedBox(
height: MediaQuery.sizeOf(context).height * 0.37,
width: 32,
child: SvgPicture.asset(
Assets.assetsIconsCurtainsIconVerticalBlade,
fit: BoxFit.fill,
),
),
);
},
),
),
), ),
), ),
); Container(
}, padding: const EdgeInsets.only(bottom: 40, right: 8),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
curve: Curves.linear,
height: MediaQuery.sizeOf(context).height * 0.4,
width: curtainWidth / 2,
child: Stack(
children: List.generate(
4,
(index) {
double spacing = curtainWidth / 8;
double rightMostPosition = index * spacing;
return AnimatedPositioned(
duration: const Duration(milliseconds: 200),
curve: Curves.linear,
right: rightMostPosition,
child: SizedBox(
height: MediaQuery.sizeOf(context).height * 0.37,
width: 32,
child: SvgPicture.asset(
Assets.rightVerticalBlade,
fit: BoxFit.fill,
),
),
);
},
),
),
),
),
],
),
), ),
), ],
),
),
Positioned(
top: 27,
left: 43,
child: SvgPicture.asset(
Assets.assetsIconsCurtainsIconCurtainHolder,
), ),
), ),
], ],

View File

@ -1,12 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_bloc.dart'; import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_bloc.dart';
import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_event.dart'; import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_event.dart';
import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_state.dart'; import 'package:syncrow_app/features/devices/bloc/garage_door_bloc/garage_door_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/garage_door_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_preferences_settings.dart'; import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_preferences_settings.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_records_screen.dart'; import 'package:syncrow_app/features/devices/view/widgets/garage_door/garage_records_screen.dart';
import 'package:syncrow_app/features/devices/view/widgets/garage_door/schedule_garage_screen.dart'; import 'package:syncrow_app/features/devices/view/widgets/garage_door/schedule_garage_screen.dart';
@ -26,34 +24,32 @@ class GarageDoorScreen extends StatelessWidget {
return DefaultScaffold( return DefaultScaffold(
title: 'Garage Door Opener', title: 'Garage Door Opener',
child: BlocProvider( child: BlocProvider(
create: (context) => GarageDoorBloc(GDId: device?.uuid ?? '') create: (context) =>
..add(const GarageDoorInitial()), GarageDoorBloc(GDId: device?.uuid ?? '')..add(const GarageDoorInitial()),
child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>( child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>(
builder: (context, state) { builder: (context, state) {
final garageBloc = BlocProvider.of<GarageDoorBloc>(context); final garageBloc = BlocProvider.of<GarageDoorBloc>(context);
GarageDoorModel model = GarageDoorModel( // GarageDoorModel model = GarageDoorModel(
tr_timecon: 0, // tr_timecon: 0,
countdown1: 0, // countdown1: 0,
countdownAlarm: 0, // countdownAlarm: 0,
doorContactState: false, // doorContactState: false,
doorControl1: '', // doorControl1: '',
doorState1: '', // doorState1: '',
switch1: false, // switch1: false,
voiceControl1: false, // voiceControl1: false,
batteryPercentage: 0, // batteryPercentage: 0,
); // );
if (state is LoadingNewSate) { // if (state is LoadingNewSate) {
model = state.doorSensor; // model = state.doorSensor;
} else if (state is UpdateState) { // } else if (state is UpdateState) {
model = state.garageSensor; // model = state.garageSensor;
} // }
return state is GarageDoorLoadingState return state is GarageDoorLoadingState
? const Center( ? const Center(
child: DefaultContainer( child:
width: 50, DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
height: 50,
child: CircularProgressIndicator()),
) )
: RefreshIndicator( : RefreshIndicator(
onRefresh: () async { onRefresh: () async {
@ -68,36 +64,30 @@ class GarageDoorScreen extends StatelessWidget {
Expanded( Expanded(
flex: 4, flex: 4,
child: InkWell( child: InkWell(
overlayColor: WidgetStateProperty.all( overlayColor: WidgetStateProperty.all(Colors.transparent),
Colors.transparent),
onTap: () {}, onTap: () {},
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.circular(890),
BorderRadius.circular(890),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.white color: Colors.white.withOpacity(0.1),
.withOpacity(0.1),
blurRadius: 24, blurRadius: 24,
offset: const Offset(-5, -5), offset: const Offset(-5, -5),
blurStyle: BlurStyle.outer, blurStyle: BlurStyle.outer,
), ),
BoxShadow( BoxShadow(
color: Colors.black color: Colors.black.withOpacity(0.11),
.withOpacity(0.11),
blurRadius: 25, blurRadius: 25,
offset: const Offset(5, 5), offset: const Offset(5, 5),
blurStyle: BlurStyle.outer, blurStyle: BlurStyle.outer,
), ),
BoxShadow( BoxShadow(
color: Colors.black color: Colors.black.withOpacity(0.13),
.withOpacity(0.13),
blurRadius: 30, blurRadius: 30,
offset: const Offset(5, 5), offset: const Offset(5, 5),
blurStyle: BlurStyle.inner, blurStyle: BlurStyle.inner,
@ -106,14 +96,12 @@ class GarageDoorScreen extends StatelessWidget {
), ),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
garageBloc.add(ToggleDoorEvent( garageBloc.add(
toggle: ToggleDoorEvent(toggle: garageBloc.toggleDoor));
garageBloc.toggleDoor));
}, },
child: GradientWidget( child: GradientWidget(
doorStatus: garageBloc.toggleDoor, doorStatus: garageBloc.toggleDoor,
seconds: seconds: garageBloc.secondSelected,
garageBloc.secondSelected,
), ),
)), )),
], ],
@ -128,8 +116,7 @@ class GarageDoorScreen extends StatelessWidget {
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => TimerScheduleScreen(
TimerScheduleScreen(
device: device!, device: device!,
switchCode: 'switch_1', switchCode: 'switch_1',
deviceCode: 'countdown_1', deviceCode: 'countdown_1',
@ -137,16 +124,13 @@ class GarageDoorScreen extends StatelessWidget {
); );
}, },
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints( constraints:
maxHeight: 46, maxWidth: 50), const BoxConstraints(maxHeight: 46, maxWidth: 50),
child: SvgPicture.asset( child: SvgPicture.asset(Assets.garageSchedule),
Assets.garageSchedule),
), ),
const SizedBox( const SizedBox(
height: 15, height: 15,
@ -179,16 +163,13 @@ class GarageDoorScreen extends StatelessWidget {
); );
}, },
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints( constraints:
maxHeight: 46, maxWidth: 50), const BoxConstraints(maxHeight: 46, maxWidth: 50),
child: SvgPicture.asset( child: SvgPicture.asset(Assets.garageCountdown),
Assets.garageCountdown),
), ),
const SizedBox( const SizedBox(
height: 15, height: 15,
@ -220,21 +201,17 @@ class GarageDoorScreen extends StatelessWidget {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
GarageRecordsScreen( GarageRecordsScreen(GDId: device!.uuid!)),
GDId: device!.uuid!)),
); );
}, },
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints( constraints:
maxHeight: 46, maxWidth: 50), const BoxConstraints(maxHeight: 46, maxWidth: 50),
child: SvgPicture.asset( child: SvgPicture.asset(Assets.doorRecordsIcon),
Assets.doorRecordsIcon),
), ),
const SizedBox( const SizedBox(
height: 15, height: 15,
@ -260,21 +237,17 @@ class GarageDoorScreen extends StatelessWidget {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
PreferencesPage( PreferencesPage(GDId: device!.uuid!)),
GDId: device!.uuid!)),
); );
}, },
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints( constraints:
maxHeight: 46, maxWidth: 50), const BoxConstraints(maxHeight: 46, maxWidth: 50),
child: SvgPicture.asset( child: SvgPicture.asset(Assets.garagePreferencesIcon),
Assets.garagePreferencesIcon),
), ),
const SizedBox( const SizedBox(
height: 15, height: 15,
@ -316,8 +289,7 @@ class GradientWidget extends StatefulWidget {
State<GradientWidget> createState() => _GradientWidgetState(); State<GradientWidget> createState() => _GradientWidgetState();
} }
class _GradientWidgetState extends State<GradientWidget> class _GradientWidgetState extends State<GradientWidget> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
late ScrollController _scrollController; late ScrollController _scrollController;
late AnimationController _animationController; late AnimationController _animationController;
late Animation<double> _itemExtentAnimation; late Animation<double> _itemExtentAnimation;
@ -330,16 +302,15 @@ class _GradientWidgetState extends State<GradientWidget>
vsync: this, vsync: this,
duration: Duration(seconds: widget.seconds), duration: Duration(seconds: widget.seconds),
); );
_itemExtentAnimation = Tween<double>( _itemExtentAnimation =
begin: widget.doorStatus ? 0 : 15, end: widget.doorStatus ? 15 : 0) Tween<double>(begin: widget.doorStatus ? 0 : 15, end: widget.doorStatus ? 15 : 0).animate(
.animate(
CurvedAnimation( CurvedAnimation(
parent: _animationController, parent: _animationController,
curve: Curves.easeInOut, curve: Curves.easeInOut,
), ),
)..addListener(() { )..addListener(() {
setState(() {}); setState(() {});
}); });
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.doorStatus) { if (widget.doorStatus) {

View File

@ -18,8 +18,7 @@ class PreferencesPage extends StatelessWidget {
return DefaultScaffold( return DefaultScaffold(
title: 'Preferences', title: 'Preferences',
child: BlocProvider( child: BlocProvider(
create: (context) => create: (context) => GarageDoorBloc(GDId: GDId)..add(const GarageDoorInitial()),
GarageDoorBloc(GDId: GDId)..add(const GarageDoorInitial()),
child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>( child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>(
builder: (context, state) { builder: (context, state) {
final garageDoorBloc = BlocProvider.of<GarageDoorBloc>(context); final garageDoorBloc = BlocProvider.of<GarageDoorBloc>(context);
@ -27,9 +26,7 @@ class PreferencesPage extends StatelessWidget {
return state is GarageDoorLoadingState return state is GarageDoorLoadingState
? const Center( ? const Center(
child: DefaultContainer( child: DefaultContainer(
width: 50, width: 50, height: 50, child: CircularProgressIndicator()),
height: 50,
child: CircularProgressIndicator()),
) )
: Column( : Column(
children: [ children: [
@ -59,8 +56,7 @@ class PreferencesPage extends StatelessWidget {
trailing: Container( trailing: Container(
width: 100, width: 100,
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.end,
MainAxisAlignment.end,
children: [ children: [
Container( Container(
height: 30, height: 30,
@ -70,8 +66,7 @@ class PreferencesPage extends StatelessWidget {
Transform.scale( Transform.scale(
scale: .8, scale: .8,
child: CupertinoSwitch( child: CupertinoSwitch(
value: value: garageDoorBloc.lowBattery,
garageDoorBloc.lowBattery,
onChanged: (value) { onChanged: (value) {
// context // context
// .read<GarageDoorBloc>() // .read<GarageDoorBloc>()
@ -108,15 +103,12 @@ class PreferencesPage extends StatelessWidget {
builder: (context) { builder: (context) {
return SecondDialog( return SecondDialog(
label2: 'Close', label2: 'Close',
initialSelectedLabel: garageDoorBloc initialSelectedLabel: garageDoorBloc.secondSelected.toString(),
.secondSelected
.toString(),
cancelTab: () { cancelTab: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: (v) { confirmTab: (v) {
garageDoorBloc garageDoorBloc.add(SelectSecondsEvent(seconds: v));
.add(SelectSecondsEvent(seconds: v));
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
title: 'Control', title: 'Control',
@ -137,10 +129,8 @@ class PreferencesPage extends StatelessWidget {
height: 90, height: 90,
width: 120, width: 120,
child: Row( child: Row(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
BodyMedium( BodyMedium(
fontColor: ColorsManager.textGray, fontColor: ColorsManager.textGray,
@ -193,7 +183,7 @@ class SecondDialog extends StatefulWidget {
} }
class _SecondDialogState extends State<SecondDialog> { class _SecondDialogState extends State<SecondDialog> {
late String _selectedOption; // late String _selectedOption;
late int selectedSecond; late int selectedSecond;
@override @override
@ -201,7 +191,7 @@ class _SecondDialogState extends State<SecondDialog> {
super.initState(); super.initState();
// Parse the initialSelectedLabel as an integer. Default to 10 if invalid or not provided. // Parse the initialSelectedLabel as an integer. Default to 10 if invalid or not provided.
selectedSecond = int.tryParse(widget.initialSelectedLabel ?? '10') ?? 10; selectedSecond = int.tryParse(widget.initialSelectedLabel ?? '10') ?? 10;
_selectedOption = widget.initialSelectedLabel ?? ''; // _selectedOption = widget.initialSelectedLabel ?? '';
} }
@override @override
@ -252,9 +242,7 @@ class _SecondDialogState extends State<SecondDialog> {
child: BodyLarge( child: BodyLarge(
text: (index + 10).toString().padLeft(2, '0'), text: (index + 10).toString().padLeft(2, '0'),
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400, fontSize: 30, color: Colors.blue),
fontSize: 30,
color: Colors.blue),
), ),
); );
}), }),

View File

@ -18,10 +18,7 @@ class TimerScheduleScreen extends StatelessWidget {
final String deviceCode; final String deviceCode;
final String switchCode; final String switchCode;
const TimerScheduleScreen( const TimerScheduleScreen(
{required this.device, {required this.device, required this.deviceCode, required this.switchCode, super.key});
required this.deviceCode,
required this.switchCode,
super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -31,22 +28,21 @@ class TimerScheduleScreen extends StatelessWidget {
statusBarIconBrightness: Brightness.light, statusBarIconBrightness: Brightness.light,
), ),
child: BlocProvider( child: BlocProvider(
create: (context) => create: (context) => GarageDoorBloc(GDId: device.uuid ?? '')..add(GetScheduleEvent()),
GarageDoorBloc(GDId: device.uuid ?? '')..add(GetScheduleEvent()),
child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>( child: BlocBuilder<GarageDoorBloc, GarageDoorSensorState>(
builder: (context, state) { builder: (context, state) {
final garageBloc = BlocProvider.of<GarageDoorBloc>(context); final garageBloc = BlocProvider.of<GarageDoorBloc>(context);
Duration duration = Duration.zero; // Duration duration = Duration.zero;
int countNum = 0; // int countNum = 0;
if (state is UpdateTimerState) { // if (state is UpdateTimerState) {
countNum = state.seconds; // countNum = state.seconds;
} else if (state is TimerRunInProgress) { // } else if (state is TimerRunInProgress) {
countNum = state.remainingTime; // countNum = state.remainingTime;
} else if (state is TimerRunComplete) { // } else if (state is TimerRunComplete) {
countNum = 0; // countNum = 0;
} else if (state is LoadingNewSate) { // } else if (state is LoadingNewSate) {
countNum = 0; // countNum = 0;
} // }
return PopScope( return PopScope(
canPop: false, canPop: false,
onPopInvoked: (didPop) { onPopInvoked: (didPop) {
@ -75,9 +71,7 @@ class TimerScheduleScreen extends StatelessWidget {
child: const Text('Save')) child: const Text('Save'))
: IconButton( : IconButton(
onPressed: () { onPressed: () {
garageBloc.add( garageBloc.add(const ToggleCreateScheduleEvent(index: 1));
const ToggleCreateScheduleEvent(
index: 1));
}, },
icon: const Icon(Icons.add), icon: const Icon(Icons.add),
) )
@ -92,8 +86,7 @@ class TimerScheduleScreen extends StatelessWidget {
decoration: const ShapeDecoration( decoration: const ShapeDecoration(
color: ColorsManager.onPrimaryColor, color: ColorsManager.onPrimaryColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.all(Radius.circular(30)),
BorderRadius.all(Radius.circular(30)),
), ),
), ),
), ),
@ -104,37 +97,25 @@ class TimerScheduleScreen extends StatelessWidget {
onToggleChanged: (bool value) { onToggleChanged: (bool value) {
garageBloc.toggleSchedule = value; garageBloc.toggleSchedule = value;
}, },
onDateTimeChanged: onDateTimeChanged: (DateTime dateTime) {
(DateTime dateTime) { garageBloc.selectedTime = dateTime;
garageBloc.selectedTime =
dateTime;
}, },
days: garageBloc.days, days: garageBloc.days,
selectDays: selectDays: (List<String> selectedDays) {
(List<String> selectedDays) { garageBloc.selectedDays = selectedDays;
garageBloc.selectedDays =
selectedDays;
}, },
) )
: Padding( : Padding(
padding: padding: const EdgeInsets.only(top: 10),
const EdgeInsets.only(top: 10),
child: ScheduleListView( child: ScheduleListView(
listSchedule: listSchedule: garageBloc.listSchedule,
garageBloc.listSchedule,
onDismissed: (scheduleId) { onDismissed: (scheduleId) {
garageBloc.listSchedule garageBloc.listSchedule.removeWhere((schedule) =>
.removeWhere((schedule) => schedule.scheduleId == scheduleId);
schedule.scheduleId == garageBloc.add(DeleteScheduleEvent(id: scheduleId));
scheduleId);
garageBloc.add(
DeleteScheduleEvent(
id: scheduleId));
}, },
onToggleSchedule: onToggleSchedule: (scheduleId, isEnabled) {
(scheduleId, isEnabled) { garageBloc.add(ToggleScheduleEvent(
garageBloc
.add(ToggleScheduleEvent(
id: scheduleId, id: scheduleId,
toggle: isEnabled, toggle: isEnabled,
)); ));

View File

@ -5,7 +5,6 @@ import 'package:syncrow_app/features/devices/bloc/one_touch_bloc/one_touch_bloc.
import 'package:syncrow_app/features/devices/bloc/one_touch_bloc/one_touch_event.dart'; import 'package:syncrow_app/features/devices/bloc/one_touch_bloc/one_touch_event.dart';
import 'package:syncrow_app/features/devices/bloc/one_touch_bloc/one_touch_state.dart'; import 'package:syncrow_app/features/devices/bloc/one_touch_bloc/one_touch_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/group_one_touch_model.dart';
import 'package:syncrow_app/features/devices/model/one_touch_model.dart'; import 'package:syncrow_app/features/devices/model/one_touch_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/circular_button.dart'; import 'package:syncrow_app/features/devices/view/widgets/circular_button.dart';
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart'; import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
@ -69,9 +68,9 @@ class OneTouchScreen extends StatelessWidget {
bottom: Constants.bottomNavBarHeight, bottom: Constants.bottomNavBarHeight,
), ),
child: BlocProvider( child: BlocProvider(
create: (context) => OneTouchBloc( create: (context) =>
switchCode: 'switch_1', oneTouchId: device?.uuid ?? '') OneTouchBloc(switchCode: 'switch_1', oneTouchId: device?.uuid ?? '')
..add(const InitialEvent(groupScreen: false)), ..add(const InitialEvent(groupScreen: false)),
child: BlocBuilder<OneTouchBloc, OneTouchState>( child: BlocBuilder<OneTouchBloc, OneTouchState>(
builder: (context, state) { builder: (context, state) {
OneTouchModel oneTouchModel = OneTouchModel( OneTouchModel oneTouchModel = OneTouchModel(
@ -81,30 +80,27 @@ class OneTouchScreen extends StatelessWidget {
relay: status.off, relay: status.off,
relay_status_1: status.off); relay_status_1: status.off);
List<GroupOneTouchModel> groupOneTouchModel = []; // List<GroupOneTouchModel> groupOneTouchModel = [];
bool allSwitchesOn = false; // bool allSwitchesOn = false;
if (state is LoadingNewSate) { if (state is LoadingNewSate) {
oneTouchModel = state.oneTouchModel; oneTouchModel = state.oneTouchModel;
} else if (state is UpdateState) { } else if (state is UpdateState) {
oneTouchModel = state.oneTouchModel; oneTouchModel = state.oneTouchModel;
} else if (state is UpdateGroupState) {
groupOneTouchModel = state.oneTouchList;
allSwitchesOn = state.allSwitches;
} }
// else if (state is UpdateGroupState) {
// groupOneTouchModel = state.oneTouchList;
// allSwitchesOn = state.allSwitches;
// }
return state is LoadingInitialState return state is LoadingInitialState
? const Center( ? const Center(
child: DefaultContainer( child: DefaultContainer(
width: 50, width: 50, height: 50, child: CircularProgressIndicator()),
height: 50,
child: CircularProgressIndicator()),
) )
: RefreshIndicator( : RefreshIndicator(
onRefresh: () async { onRefresh: () async {
BlocProvider.of<OneTouchBloc>(context).add( BlocProvider.of<OneTouchBloc>(context)
InitialEvent( .add(InitialEvent(groupScreen: device != null ? false : true));
groupScreen:
device != null ? false : true));
}, },
child: ListView( child: ListView(
children: [ children: [
@ -112,30 +108,23 @@ class OneTouchScreen extends StatelessWidget {
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.stretch,
CrossAxisAlignment.stretch,
children: [ children: [
const Expanded(child: SizedBox.shrink()), const Expanded(child: SizedBox.shrink()),
Expanded( Expanded(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceAround,
MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Column( Column(
children: [ children: [
GangSwitch( GangSwitch(
threeGangSwitch: device!, threeGangSwitch: device!,
value: value: oneTouchModel.firstSwitch,
oneTouchModel.firstSwitch,
action: () { action: () {
BlocProvider.of< BlocProvider.of<OneTouchBloc>(context).add(
OneTouchBloc>( ChangeFirstSwitchStatusEvent(
context) value: oneTouchModel.firstSwitch));
.add(ChangeFirstSwitchStatusEvent(
value: oneTouchModel
.firstSwitch));
}, },
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@ -143,8 +132,7 @@ class OneTouchScreen extends StatelessWidget {
width: 70, width: 70,
child: BodySmall( child: BodySmall(
text: " Entrance Light", text: " Entrance Light",
fontColor: ColorsManager fontColor: ColorsManager.textPrimaryColor,
.textPrimaryColor,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
@ -155,10 +143,8 @@ class OneTouchScreen extends StatelessWidget {
), ),
Center( Center(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
CircularButton( CircularButton(
device: device, device: device,
@ -168,16 +154,13 @@ class OneTouchScreen extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
PageRouteBuilder( PageRouteBuilder(
pageBuilder: (context, pageBuilder:
animation1, (context, animation1, animation2) =>
animation2) => TimerScheduleScreen(
TimerScheduleScreen( switchCode: 'switch_1',
switchCode: device: device!,
'switch_1', deviceCode: 'countdown_1',
device: device!, )));
deviceCode:
'countdown_1',
)));
}, },
), ),
const SizedBox( const SizedBox(
@ -191,12 +174,11 @@ class OneTouchScreen extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
PageRouteBuilder( PageRouteBuilder(
pageBuilder: (context, pageBuilder:
animation1, (context, animation1, animation2) =>
animation2) => OneTouchSetting(
OneTouchSetting( device: device,
device: device, )));
)));
}, },
), ),
], ],

View File

@ -4,7 +4,6 @@ import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_b
import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_event.dart'; import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_event.dart';
import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_state.dart'; import 'package:syncrow_app/features/devices/bloc/three_touch_bloc/three_touch_state.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/three_touch_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/restart_status_dialog.dart'; import 'package:syncrow_app/features/devices/view/widgets/restart_status_dialog.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
@ -23,41 +22,15 @@ class ThreeTouchSetting extends StatelessWidget {
return DefaultScaffold( return DefaultScaffold(
title: 'Setting', title: 'Setting',
child: BlocProvider( child: BlocProvider(
create: (context) => create: (context) => ThreeTouchBloc(switchCode: '', threeTouchId: device?.uuid ?? '')
ThreeTouchBloc(switchCode: '', threeTouchId: device?.uuid ?? '') ..add(InitialEvent(groupScreen: false)),
..add(InitialEvent(groupScreen: false)),
child: BlocBuilder<ThreeTouchBloc, ThreeTouchState>( child: BlocBuilder<ThreeTouchBloc, ThreeTouchState>(
builder: (context, state) { builder: (context, state) {
final threeTouchBloc = BlocProvider.of<ThreeTouchBloc>(context); final threeTouchBloc = BlocProvider.of<ThreeTouchBloc>(context);
ThreeTouchModel deviceStatus = ThreeTouchModel(
firstSwitch: false,
secondSwitch: false,
thirdSwitch: false,
firstCountDown: 0,
secondCountDown: 0,
thirdCountDown: 0,
light_mode: lightStatus.off,
relay: status.off,
relay_status_1: status.off,
relay_status_2: status.off,
relay_status_3: status.off,
);
if (state is LoadingNewSate) {
deviceStatus = state.threeTouchModel;
} else if (state is UpdateState) {
deviceStatus = state.threeTouchModel;
}
// if (state is ChangeStateSetting) {
// // Navigator.of(context).pop(true);
// threeTouchBloc
// .add(InitialSettingDevises(id: device?.uuid ?? ''));
// }
return state is LoadingInitialState return state is LoadingInitialState
? const Center( ? const Center(
child: DefaultContainer( child: DefaultContainer(
width: 50, width: 50, height: 50, child: CircularProgressIndicator()),
height: 50,
child: CircularProgressIndicator()),
) )
: Column( : Column(
children: [ children: [
@ -70,22 +43,19 @@ class ThreeTouchSetting extends StatelessWidget {
children: [ children: [
InkWell( InkWell(
onTap: () async { onTap: () async {
threeTouchBloc.optionSelected = threeTouchBloc.optionSelected = 'relay_status';
'relay_status';
final result = await showDialog( final result = await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return RestartStatusDialog( return RestartStatusDialog(
initialSelectedLabel: threeTouchBloc initialSelectedLabel:
.deviceStatus.relay.value, threeTouchBloc.deviceStatus.relay.value,
cancelTab: () { cancelTab: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: () { confirmTab: () {
threeTouchBloc.add( threeTouchBloc.add(ChangeStatusEvent(
ChangeStatusEvent( deviceId: device!.uuid!, context: context));
deviceId: device!.uuid!,
context: context));
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
title: 'Restart Status', title: 'Restart Status',
@ -93,34 +63,27 @@ class ThreeTouchSetting extends StatelessWidget {
label2: 'Power On', label2: 'Power On',
label3: 'Restart Memory', label3: 'Restart Memory',
onTapLabel1: (selected) { onTapLabel1: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel2: (selected) { onTapLabel2: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel3: (selected) { onTapLabel3: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
); );
}, },
); );
if (result == true) { if (result == true) {
Future.delayed(const Duration(seconds: 2), Future.delayed(const Duration(seconds: 2), () async {
() async { threeTouchBloc.add(InitialEvent(groupScreen: false));
threeTouchBloc.add(
InitialEvent(groupScreen: false));
}); });
} }
}, },
child: Container( child: Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(bottom: 10, top: 10),
bottom: 10, top: 10),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
const BodyLarge( const BodyLarge(
fontSize: 15, fontSize: 15,
@ -131,10 +94,8 @@ class ThreeTouchSetting extends StatelessWidget {
children: [ children: [
BodyMedium( BodyMedium(
fontSize: 13, fontSize: 13,
text: threeTouchBloc text: threeTouchBloc.deviceStatus.relay.value,
.deviceStatus.relay.value, fontColor: ColorsManager.textGray,
fontColor:
ColorsManager.textGray,
), ),
const Icon( const Icon(
Icons.keyboard_arrow_right, Icons.keyboard_arrow_right,
@ -149,26 +110,22 @@ class ThreeTouchSetting extends StatelessWidget {
color: ColorsManager.graysColor, color: ColorsManager.graysColor,
), ),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(bottom: 10, top: 10),
bottom: 10, top: 10),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
threeTouchBloc.optionSelected = threeTouchBloc.optionSelected = 'light_mode';
'light_mode';
final result = await showDialog( final result = await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return RestartStatusDialog( return RestartStatusDialog(
initialSelectedLabel: threeTouchBloc initialSelectedLabel:
.deviceStatus.light_mode.value, threeTouchBloc.deviceStatus.light_mode.value,
cancelTab: () { cancelTab: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: () { confirmTab: () {
threeTouchBloc.add( threeTouchBloc.add(ChangeStatusEvent(
ChangeStatusEvent( deviceId: device!.uuid!, context: context));
deviceId: device!.uuid!,
context: context));
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
title: 'Indicator Status', title: 'Indicator Status',
@ -176,33 +133,26 @@ class ThreeTouchSetting extends StatelessWidget {
label2: 'On/Off Status', label2: 'On/Off Status',
label3: 'Switch Position', label3: 'Switch Position',
onTapLabel1: (selected) { onTapLabel1: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel2: (selected) { onTapLabel2: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel3: (selected) { onTapLabel3: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
); );
}, },
); );
if (result == true) { if (result == true) {
Future.delayed( Future.delayed(const Duration(seconds: 2), () async {
const Duration(seconds: 2), threeTouchBloc.add(InitialEvent(groupScreen: false));
() async {
threeTouchBloc.add(
InitialEvent(groupScreen: false));
}); });
} }
}, },
child: SizedBox( child: SizedBox(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
const BodyLarge( const BodyLarge(
fontSize: 15, fontSize: 15,
@ -213,8 +163,7 @@ class ThreeTouchSetting extends StatelessWidget {
children: [ children: [
BodyMedium( BodyMedium(
fontSize: 13, fontSize: 13,
text: threeTouchBloc.deviceStatus text: threeTouchBloc.deviceStatus.light_mode.value,
.light_mode.value,
fontColor: ColorsManager.textGray, fontColor: ColorsManager.textGray,
), ),
const Icon( const Icon(
@ -231,27 +180,22 @@ class ThreeTouchSetting extends StatelessWidget {
color: ColorsManager.graysColor, color: ColorsManager.graysColor,
), ),
Container( Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(bottom: 10, top: 10),
bottom: 10, top: 10),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
threeTouchBloc.optionSelected = threeTouchBloc.optionSelected = 'relay_status_1';
'relay_status_1';
final result = await showDialog( final result = await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return RestartStatusDialog( return RestartStatusDialog(
initialSelectedLabel: initialSelectedLabel:
threeTouchBloc.deviceStatus threeTouchBloc.deviceStatus.relay_status_1.value,
.relay_status_1.value,
cancelTab: () { cancelTab: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: () { confirmTab: () {
threeTouchBloc.add( threeTouchBloc.add(ChangeStatusEvent(
ChangeStatusEvent( deviceId: device!.uuid!, context: context));
deviceId: device!.uuid!,
context: context));
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
title: 'Restart Status 1', title: 'Restart Status 1',
@ -259,33 +203,26 @@ class ThreeTouchSetting extends StatelessWidget {
label2: 'Power On', label2: 'Power On',
label3: 'Restart Memory', label3: 'Restart Memory',
onTapLabel1: (selected) { onTapLabel1: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel2: (selected) { onTapLabel2: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel3: (selected) { onTapLabel3: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
); );
}, },
); );
if (result == true) { if (result == true) {
Future.delayed( Future.delayed(const Duration(seconds: 2), () async {
const Duration(seconds: 2), threeTouchBloc
() async { .add(const InitialEvent(groupScreen: false));
threeTouchBloc.add(
const InitialEvent(
groupScreen: false));
}); });
} }
}, },
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
const BodyLarge( const BodyLarge(
fontSize: 15, fontSize: 15,
@ -297,11 +234,8 @@ class ThreeTouchSetting extends StatelessWidget {
BodyMedium( BodyMedium(
fontSize: 13, fontSize: 13,
text: threeTouchBloc text: threeTouchBloc
.deviceStatus .deviceStatus.relay_status_1.value,
.relay_status_1 fontColor: ColorsManager.textGray,
.value,
fontColor:
ColorsManager.textGray,
), ),
const Icon( const Icon(
Icons.keyboard_arrow_right, Icons.keyboard_arrow_right,
@ -316,27 +250,22 @@ class ThreeTouchSetting extends StatelessWidget {
color: ColorsManager.graysColor, color: ColorsManager.graysColor,
), ),
Container( Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(bottom: 10, top: 10),
bottom: 10, top: 10),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
threeTouchBloc.optionSelected = threeTouchBloc.optionSelected = 'relay_status_2';
'relay_status_2';
final result = await showDialog( final result = await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return RestartStatusDialog( return RestartStatusDialog(
initialSelectedLabel: initialSelectedLabel:
threeTouchBloc.deviceStatus threeTouchBloc.deviceStatus.relay_status_2.value,
.relay_status_2.value,
cancelTab: () { cancelTab: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: () { confirmTab: () {
threeTouchBloc.add( threeTouchBloc.add(ChangeStatusEvent(
ChangeStatusEvent( deviceId: device!.uuid!, context: context));
deviceId: device!.uuid!,
context: context));
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
title: 'Restart Status 2', title: 'Restart Status 2',
@ -344,36 +273,28 @@ class ThreeTouchSetting extends StatelessWidget {
label2: 'Power On', label2: 'Power On',
label3: 'Restart Memory', label3: 'Restart Memory',
onTapLabel1: (selected) { onTapLabel1: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel2: (selected) { onTapLabel2: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel3: (selected) { onTapLabel3: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
); );
}, },
); );
if (result == true) { if (result == true) {
Future.delayed( Future.delayed(const Duration(seconds: 2), () async {
const Duration(seconds: 2), threeTouchBloc
() async { .add(const InitialEvent(groupScreen: false));
threeTouchBloc.add( threeTouchBloc
const InitialEvent( .add(const InitialEvent(groupScreen: false));
groupScreen: false));
threeTouchBloc.add(
const InitialEvent(
groupScreen: false));
}); });
} }
}, },
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
const BodyLarge( const BodyLarge(
fontSize: 15, fontSize: 15,
@ -385,11 +306,8 @@ class ThreeTouchSetting extends StatelessWidget {
BodyMedium( BodyMedium(
fontSize: 13, fontSize: 13,
text: threeTouchBloc text: threeTouchBloc
.deviceStatus .deviceStatus.relay_status_2.value,
.relay_status_2 fontColor: ColorsManager.textGray,
.value,
fontColor:
ColorsManager.textGray,
), ),
const Icon( const Icon(
Icons.keyboard_arrow_right, Icons.keyboard_arrow_right,
@ -404,27 +322,22 @@ class ThreeTouchSetting extends StatelessWidget {
color: ColorsManager.graysColor, color: ColorsManager.graysColor,
), ),
Container( Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(bottom: 10, top: 10),
bottom: 10, top: 10),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
threeTouchBloc.optionSelected = threeTouchBloc.optionSelected = 'relay_status_3';
'relay_status_3';
final result = await showDialog( final result = await showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return RestartStatusDialog( return RestartStatusDialog(
initialSelectedLabel: initialSelectedLabel:
threeTouchBloc.deviceStatus threeTouchBloc.deviceStatus.relay_status_3.value,
.relay_status_3.value,
cancelTab: () { cancelTab: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: () { confirmTab: () {
threeTouchBloc.add( threeTouchBloc.add(ChangeStatusEvent(
ChangeStatusEvent( deviceId: device!.uuid!, context: context));
deviceId: device!.uuid!,
context: context));
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
title: 'Restart Status 3', title: 'Restart Status 3',
@ -432,36 +345,28 @@ class ThreeTouchSetting extends StatelessWidget {
label2: 'Power On', label2: 'Power On',
label3: 'Restart Memory', label3: 'Restart Memory',
onTapLabel1: (selected) { onTapLabel1: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel2: (selected) { onTapLabel2: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
onTapLabel3: (selected) { onTapLabel3: (selected) {
threeTouchBloc.statusSelected = threeTouchBloc.statusSelected = selected;
selected;
}, },
); );
}, },
); );
if (result == true) { if (result == true) {
Future.delayed( Future.delayed(const Duration(seconds: 2), () async {
const Duration(seconds: 2), threeTouchBloc
() async { .add(const InitialEvent(groupScreen: false));
threeTouchBloc.add( threeTouchBloc
const InitialEvent( .add(const InitialEvent(groupScreen: false));
groupScreen: false));
threeTouchBloc.add(
const InitialEvent(
groupScreen: false));
}); });
} }
}, },
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
const BodyLarge( const BodyLarge(
fontSize: 15, fontSize: 15,
@ -473,11 +378,8 @@ class ThreeTouchSetting extends StatelessWidget {
BodyMedium( BodyMedium(
fontSize: 13, fontSize: 13,
text: threeTouchBloc text: threeTouchBloc
.deviceStatus .deviceStatus.relay_status_3.value,
.relay_status_3 fontColor: ColorsManager.textGray,
.value,
fontColor:
ColorsManager.textGray,
), ),
const Icon( const Icon(
Icons.keyboard_arrow_right, Icons.keyboard_arrow_right,

View File

@ -19,28 +19,29 @@ class WHWizard extends StatelessWidget {
List<GroupWHModel> groupModel = []; List<GroupWHModel> groupModel = [];
return DefaultScaffold( return DefaultScaffold(
title: 'Water Heater',
child: BlocProvider( child: BlocProvider(
create: (context) => create: (context) =>
WaterHeaterBloc(switchCode: '', whId: device?.uuid ?? '')..add(InitialWizardEvent()), WaterHeaterBloc(switchCode: '', whId: device?.uuid ?? '')..add(InitialWizardEvent()),
child: BlocBuilder<WaterHeaterBloc, WaterHeaterState>( child: BlocBuilder<WaterHeaterBloc, WaterHeaterState>(
builder: (context, state) { builder: (context, state) {
bool allSwitchesOn = false; bool allSwitchesOn = false;
if (state is UpdateGroupState) { if (state is UpdateGroupState) {
groupModel = state.twoGangList; groupModel = state.twoGangList;
allSwitchesOn = state.allSwitches; allSwitchesOn = state.allSwitches;
} }
return state is WHLoadingState return state is WHLoadingState
? const Center( ? const Center(
child: child: DefaultContainer(
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), width: 50, height: 50, child: CircularProgressIndicator()),
) )
: WHList( : WHList(
whList: groupModel, whList: groupModel,
allSwitches: allSwitchesOn, allSwitches: allSwitchesOn,
); );
}, },
), ),
)); ));
} }
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart'; import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart'; import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart';
import 'package:syncrow_app/features/menu/view/widgets/menu_list.dart'; import 'package:syncrow_app/features/menu/view/widgets/menu_list.dart';
@ -7,7 +8,6 @@ import 'package:syncrow_app/features/menu/view/widgets/profile/profile_tab.dart'
import 'package:syncrow_app/features/shared_widgets/default_container.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/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/services/locator.dart';
import 'package:syncrow_app/utils/context_extension.dart'; import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart';
@ -34,7 +34,7 @@ class MenuView extends StatelessWidget {
const SizedBox( const SizedBox(
height: 15, height: 15,
), ),
BodyMedium(text: serviceLocator.get<String>()), BodyMedium(text: dotenv.env['ENV_NAME'] ?? ''),
const SizedBox( const SizedBox(
height: 15, height: 15,
), ),

View File

@ -3,8 +3,7 @@ class Assets {
/// Assets for assetsFontsAftikaRegular /// Assets for assetsFontsAftikaRegular
/// assets/fonts/AftikaRegular.ttf /// assets/fonts/AftikaRegular.ttf
static const String assetsFontsAftikaRegular = static const String assetsFontsAftikaRegular = "assets/fonts/AftikaRegular.ttf";
"assets/fonts/AftikaRegular.ttf";
/// Assets for assetsIcons3GangSwitch /// Assets for assetsIcons3GangSwitch
/// assets/icons/3GangSwitch.svg /// assets/icons/3GangSwitch.svg
@ -20,98 +19,82 @@ class Assets {
/// Assets for assetsIconsAutomatedClock /// Assets for assetsIconsAutomatedClock
/// assets/icons/automated_clock.svg /// assets/icons/automated_clock.svg
static const String assetsIconsAutomatedClock = static const String assetsIconsAutomatedClock = "assets/icons/automated_clock.svg";
"assets/icons/automated_clock.svg";
static const String acSwitchIcon = "assets/icons/ac_switch_ic.svg"; static const String acSwitchIcon = "assets/icons/ac_switch_ic.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstChargeddmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstChargeddmOff
/// assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstChargeddmOff.svg /// assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstChargeddmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstChargeddmOff =
assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstChargeddmOff =
"assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstChargeddmOff.svg"; "assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstChargeddmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstDefaultdmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstDefaultdmOff
/// assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstDefaultdmOff.svg /// assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstDefaultdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstDefaultdmOff =
assetsIconsBatteryDmOffPerOffchargOfflowOffpmOffstDefaultdmOff =
"assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstDefaultdmOff.svg"; "assets/icons/battery/dmOff/perOffchargOfflowOffpmOffstDefaultdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOffpmOnstChargeddmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOffpmOnstChargeddmOff
/// assets/icons/battery/dmOff/perOffchargOfflowOffpmOnstChargeddmOff.svg /// assets/icons/battery/dmOff/perOffchargOfflowOffpmOnstChargeddmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOfflowOffpmOnstChargeddmOff =
assetsIconsBatteryDmOffPerOffchargOfflowOffpmOnstChargeddmOff =
"assets/icons/battery/dmOff/perOffchargOfflowOffpmOnstChargeddmOff.svg"; "assets/icons/battery/dmOff/perOffchargOfflowOffpmOnstChargeddmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOnpmOffstDefaultdmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOnpmOffstDefaultdmOff
/// assets/icons/battery/dmOff/perOffchargOfflowOnpmOffstDefaultdmOff.svg /// assets/icons/battery/dmOff/perOffchargOfflowOnpmOffstDefaultdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOfflowOnpmOffstDefaultdmOff =
assetsIconsBatteryDmOffPerOffchargOfflowOnpmOffstDefaultdmOff =
"assets/icons/battery/dmOff/perOffchargOfflowOnpmOffstDefaultdmOff.svg"; "assets/icons/battery/dmOff/perOffchargOfflowOnpmOffstDefaultdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOnpmOnstDefaultdmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOfflowOnpmOnstDefaultdmOff
/// assets/icons/battery/dmOff/perOffchargOfflowOnpmOnstDefaultdmOff.svg /// assets/icons/battery/dmOff/perOffchargOfflowOnpmOnstDefaultdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOfflowOnpmOnstDefaultdmOff =
assetsIconsBatteryDmOffPerOffchargOfflowOnpmOnstDefaultdmOff =
"assets/icons/battery/dmOff/perOffchargOfflowOnpmOnstDefaultdmOff.svg"; "assets/icons/battery/dmOff/perOffchargOfflowOnpmOnstDefaultdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOnlowOffpmOffstChargeddmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOnlowOffpmOffstChargeddmOff
/// assets/icons/battery/dmOff/perOffchargOnlowOffpmOffstChargeddmOff.svg /// assets/icons/battery/dmOff/perOffchargOnlowOffpmOffstChargeddmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOnlowOffpmOffstChargeddmOff =
assetsIconsBatteryDmOffPerOffchargOnlowOffpmOffstChargeddmOff =
"assets/icons/battery/dmOff/perOffchargOnlowOffpmOffstChargeddmOff.svg"; "assets/icons/battery/dmOff/perOffchargOnlowOffpmOffstChargeddmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOnlowOnpmOffstlowBatterydmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOnlowOnpmOffstlowBatterydmOff
/// assets/icons/battery/dmOff/perOffchargOnlowOnpmOffstlowBatterydmOff.svg /// assets/icons/battery/dmOff/perOffchargOnlowOnpmOffstlowBatterydmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOnlowOnpmOffstlowBatterydmOff =
assetsIconsBatteryDmOffPerOffchargOnlowOnpmOffstlowBatterydmOff =
"assets/icons/battery/dmOff/perOffchargOnlowOnpmOffstlowBatterydmOff.svg"; "assets/icons/battery/dmOff/perOffchargOnlowOnpmOffstlowBatterydmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOffchargOnlowOnpmOnstlowpmdmOff /// Assets for assetsIconsBatteryDmOffPerOffchargOnlowOnpmOnstlowpmdmOff
/// assets/icons/battery/dmOff/perOffchargOnlowOnpmOnstlowpmdmOff.svg /// assets/icons/battery/dmOff/perOffchargOnlowOnpmOnstlowpmdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOffchargOnlowOnpmOnstlowpmdmOff =
assetsIconsBatteryDmOffPerOffchargOnlowOnpmOnstlowpmdmOff =
"assets/icons/battery/dmOff/perOffchargOnlowOnpmOnstlowpmdmOff.svg"; "assets/icons/battery/dmOff/perOffchargOnlowOnpmOnstlowpmdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstChargeddmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstChargeddmOff
/// assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstChargeddmOff.svg /// assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstChargeddmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstChargeddmOff =
assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstChargeddmOff =
"assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstChargeddmOff.svg"; "assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstChargeddmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstDefaultdmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstDefaultdmOff
/// assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstDefaultdmOff.svg /// assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstDefaultdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstDefaultdmOff =
assetsIconsBatteryDmOffPerOnchargOfflowOffpmOffstDefaultdmOff =
"assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstDefaultdmOff.svg"; "assets/icons/battery/dmOff/perOnchargOfflowOffpmOffstDefaultdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOffpmOnstChargeddmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOffpmOnstChargeddmOff
/// assets/icons/battery/dmOff/perOnchargOfflowOffpmOnstChargeddmOff.svg /// assets/icons/battery/dmOff/perOnchargOfflowOffpmOnstChargeddmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOfflowOffpmOnstChargeddmOff =
assetsIconsBatteryDmOffPerOnchargOfflowOffpmOnstChargeddmOff =
"assets/icons/battery/dmOff/perOnchargOfflowOffpmOnstChargeddmOff.svg"; "assets/icons/battery/dmOff/perOnchargOfflowOffpmOnstChargeddmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOnpmOffstDefaultdmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOnpmOffstDefaultdmOff
/// assets/icons/battery/dmOff/perOnchargOfflowOnpmOffstDefaultdmOff.svg /// assets/icons/battery/dmOff/perOnchargOfflowOnpmOffstDefaultdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOfflowOnpmOffstDefaultdmOff =
assetsIconsBatteryDmOffPerOnchargOfflowOnpmOffstDefaultdmOff =
"assets/icons/battery/dmOff/perOnchargOfflowOnpmOffstDefaultdmOff.svg"; "assets/icons/battery/dmOff/perOnchargOfflowOnpmOffstDefaultdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOnpmOnstDefaultdmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOfflowOnpmOnstDefaultdmOff
/// assets/icons/battery/dmOff/perOnchargOfflowOnpmOnstDefaultdmOff.svg /// assets/icons/battery/dmOff/perOnchargOfflowOnpmOnstDefaultdmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOfflowOnpmOnstDefaultdmOff =
assetsIconsBatteryDmOffPerOnchargOfflowOnpmOnstDefaultdmOff =
"assets/icons/battery/dmOff/perOnchargOfflowOnpmOnstDefaultdmOff.svg"; "assets/icons/battery/dmOff/perOnchargOfflowOnpmOnstDefaultdmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOnlowOffpmOffstChargeddmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOnlowOffpmOffstChargeddmOff
/// assets/icons/battery/dmOff/perOnchargOnlowOffpmOffstChargeddmOff.svg /// assets/icons/battery/dmOff/perOnchargOnlowOffpmOffstChargeddmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOnlowOffpmOffstChargeddmOff =
assetsIconsBatteryDmOffPerOnchargOnlowOffpmOffstChargeddmOff =
"assets/icons/battery/dmOff/perOnchargOnlowOffpmOffstChargeddmOff.svg"; "assets/icons/battery/dmOff/perOnchargOnlowOffpmOffstChargeddmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOnlowOnpmOffstlowBatterydmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOnlowOnpmOffstlowBatterydmOff
/// assets/icons/battery/dmOff/perOnchargOnlowOnpmOffstlowBatterydmOff.svg /// assets/icons/battery/dmOff/perOnchargOnlowOnpmOffstlowBatterydmOff.svg
static const String static const String assetsIconsBatteryDmOffPerOnchargOnlowOnpmOffstlowBatterydmOff =
assetsIconsBatteryDmOffPerOnchargOnlowOnpmOffstlowBatterydmOff =
"assets/icons/battery/dmOff/perOnchargOnlowOnpmOffstlowBatterydmOff.svg"; "assets/icons/battery/dmOff/perOnchargOnlowOnpmOffstlowBatterydmOff.svg";
/// Assets for assetsIconsBatteryDmOffPerOnchargOnlowOnpmOnstlowpmdmOff /// Assets for assetsIconsBatteryDmOffPerOnchargOnlowOnpmOnstlowpmdmOff
@ -121,44 +104,37 @@ class Assets {
/// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstChargeddmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstChargeddmOn
/// assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstChargeddmOn.svg /// assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstChargeddmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstChargeddmOn =
assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstChargeddmOn =
"assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstChargeddmOn.svg"; "assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstChargeddmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstDefaultdmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstDefaultdmOn
/// assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstDefaultdmOn.svg /// assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstDefaultdmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstDefaultdmOn =
assetsIconsBatteryDmOnPerOffchargOfflowOffpmOffstDefaultdmOn =
"assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstDefaultdmOn.svg"; "assets/icons/battery/dmOn/perOffchargOfflowOffpmOffstDefaultdmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOffpmOnstChargeddmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOffpmOnstChargeddmOn
/// assets/icons/battery/dmOn/perOffchargOfflowOffpmOnstChargeddmOn.svg /// assets/icons/battery/dmOn/perOffchargOfflowOffpmOnstChargeddmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOfflowOffpmOnstChargeddmOn =
assetsIconsBatteryDmOnPerOffchargOfflowOffpmOnstChargeddmOn =
"assets/icons/battery/dmOn/perOffchargOfflowOffpmOnstChargeddmOn.svg"; "assets/icons/battery/dmOn/perOffchargOfflowOffpmOnstChargeddmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOnpmOffstDefaultdmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOnpmOffstDefaultdmOn
/// assets/icons/battery/dmOn/perOffchargOfflowOnpmOffstDefaultdmOn.svg /// assets/icons/battery/dmOn/perOffchargOfflowOnpmOffstDefaultdmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOfflowOnpmOffstDefaultdmOn =
assetsIconsBatteryDmOnPerOffchargOfflowOnpmOffstDefaultdmOn =
"assets/icons/battery/dmOn/perOffchargOfflowOnpmOffstDefaultdmOn.svg"; "assets/icons/battery/dmOn/perOffchargOfflowOnpmOffstDefaultdmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOnpmOnstDefaultdmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOfflowOnpmOnstDefaultdmOn
/// assets/icons/battery/dmOn/perOffchargOfflowOnpmOnstDefaultdmOn.svg /// assets/icons/battery/dmOn/perOffchargOfflowOnpmOnstDefaultdmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOfflowOnpmOnstDefaultdmOn =
assetsIconsBatteryDmOnPerOffchargOfflowOnpmOnstDefaultdmOn =
"assets/icons/battery/dmOn/perOffchargOfflowOnpmOnstDefaultdmOn.svg"; "assets/icons/battery/dmOn/perOffchargOfflowOnpmOnstDefaultdmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOnlowOffpmOffstChargeddmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOnlowOffpmOffstChargeddmOn
/// assets/icons/battery/dmOn/perOffchargOnlowOffpmOffstChargeddmOn.svg /// assets/icons/battery/dmOn/perOffchargOnlowOffpmOffstChargeddmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOnlowOffpmOffstChargeddmOn =
assetsIconsBatteryDmOnPerOffchargOnlowOffpmOffstChargeddmOn =
"assets/icons/battery/dmOn/perOffchargOnlowOffpmOffstChargeddmOn.svg"; "assets/icons/battery/dmOn/perOffchargOnlowOffpmOffstChargeddmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOnlowOnpmOffstlowBatterydmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOnlowOnpmOffstlowBatterydmOn
/// assets/icons/battery/dmOn/perOffchargOnlowOnpmOffstlowBatterydmOn.svg /// assets/icons/battery/dmOn/perOffchargOnlowOnpmOffstlowBatterydmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOffchargOnlowOnpmOffstlowBatterydmOn =
assetsIconsBatteryDmOnPerOffchargOnlowOnpmOffstlowBatterydmOn =
"assets/icons/battery/dmOn/perOffchargOnlowOnpmOffstlowBatterydmOn.svg"; "assets/icons/battery/dmOn/perOffchargOnlowOnpmOffstlowBatterydmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOffchargOnlowOnpmOnstlowpmdmOn /// Assets for assetsIconsBatteryDmOnPerOffchargOnlowOnpmOnstlowpmdmOn
@ -168,44 +144,37 @@ class Assets {
/// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstChargeddmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstChargeddmOn
/// assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstChargeddmOn.svg /// assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstChargeddmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstChargeddmOn =
assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstChargeddmOn =
"assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstChargeddmOn.svg"; "assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstChargeddmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstDefaultdmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstDefaultdmOn
/// assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstDefaultdmOn.svg /// assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstDefaultdmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstDefaultdmOn =
assetsIconsBatteryDmOnPerOnchargOfflowOffpmOffstDefaultdmOn =
"assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstDefaultdmOn.svg"; "assets/icons/battery/dmOn/perOnchargOfflowOffpmOffstDefaultdmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOffpmOnstChargeddmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOffpmOnstChargeddmOn
/// assets/icons/battery/dmOn/perOnchargOfflowOffpmOnstChargeddmOn.svg /// assets/icons/battery/dmOn/perOnchargOfflowOffpmOnstChargeddmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOfflowOffpmOnstChargeddmOn =
assetsIconsBatteryDmOnPerOnchargOfflowOffpmOnstChargeddmOn =
"assets/icons/battery/dmOn/perOnchargOfflowOffpmOnstChargeddmOn.svg"; "assets/icons/battery/dmOn/perOnchargOfflowOffpmOnstChargeddmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOnpmOffstDefaultdmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOnpmOffstDefaultdmOn
/// assets/icons/battery/dmOn/perOnchargOfflowOnpmOffstDefaultdmOn.svg /// assets/icons/battery/dmOn/perOnchargOfflowOnpmOffstDefaultdmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOfflowOnpmOffstDefaultdmOn =
assetsIconsBatteryDmOnPerOnchargOfflowOnpmOffstDefaultdmOn =
"assets/icons/battery/dmOn/perOnchargOfflowOnpmOffstDefaultdmOn.svg"; "assets/icons/battery/dmOn/perOnchargOfflowOnpmOffstDefaultdmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOnpmOnstDefaultdmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOfflowOnpmOnstDefaultdmOn
/// assets/icons/battery/dmOn/perOnchargOfflowOnpmOnstDefaultdmOn.svg /// assets/icons/battery/dmOn/perOnchargOfflowOnpmOnstDefaultdmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOfflowOnpmOnstDefaultdmOn =
assetsIconsBatteryDmOnPerOnchargOfflowOnpmOnstDefaultdmOn =
"assets/icons/battery/dmOn/perOnchargOfflowOnpmOnstDefaultdmOn.svg"; "assets/icons/battery/dmOn/perOnchargOfflowOnpmOnstDefaultdmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOnlowOffpmOffstChargeddmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOnlowOffpmOffstChargeddmOn
/// assets/icons/battery/dmOn/perOnchargOnlowOffpmOffstChargeddmOn.svg /// assets/icons/battery/dmOn/perOnchargOnlowOffpmOffstChargeddmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOnlowOffpmOffstChargeddmOn =
assetsIconsBatteryDmOnPerOnchargOnlowOffpmOffstChargeddmOn =
"assets/icons/battery/dmOn/perOnchargOnlowOffpmOffstChargeddmOn.svg"; "assets/icons/battery/dmOn/perOnchargOnlowOffpmOffstChargeddmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOnlowOnpmOffstlowBatterydmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOnlowOnpmOffstlowBatterydmOn
/// assets/icons/battery/dmOn/perOnchargOnlowOnpmOffstlowBatterydmOn.svg /// assets/icons/battery/dmOn/perOnchargOnlowOnpmOffstlowBatterydmOn.svg
static const String static const String assetsIconsBatteryDmOnPerOnchargOnlowOnpmOffstlowBatterydmOn =
assetsIconsBatteryDmOnPerOnchargOnlowOnpmOffstlowBatterydmOn =
"assets/icons/battery/dmOn/perOnchargOnlowOnpmOffstlowBatterydmOn.svg"; "assets/icons/battery/dmOn/perOnchargOnlowOnpmOffstlowBatterydmOn.svg";
/// Assets for assetsIconsBatteryDmOnPerOnchargOnlowOnpmOnstlowpmdmOn /// Assets for assetsIconsBatteryDmOnPerOnchargOnlowOnpmOnstlowpmdmOn
@ -247,7 +216,9 @@ class Assets {
/// Assets for assetsIconsCurtainsIconVerticalBlade /// Assets for assetsIconsCurtainsIconVerticalBlade
/// assets/icons/curtainsIcon/verticalBlade.svg /// assets/icons/curtainsIcon/verticalBlade.svg
static const String assetsIconsCurtainsIconVerticalBlade = static const String assetsIconsCurtainsIconVerticalBlade =
"assets/icons/curtainsIcon/verticalBlade.svg"; "assets/icons/curtainsIcon/left_vertical_blade.svg";
static const String rightVerticalBlade = "assets/icons/curtainsIcon/right_vertical_blade.svg";
/// Assets for assetsIconsDashboard /// Assets for assetsIconsDashboard
/// assets/icons/dashboard.svg /// assets/icons/dashboard.svg
@ -257,8 +228,7 @@ class Assets {
/// Assets for assetsIconsDashboardFill /// Assets for assetsIconsDashboardFill
/// assets/icons/dashboard-fill.svg /// assets/icons/dashboard-fill.svg
static const String assetsIconsDashboardFill = static const String assetsIconsDashboardFill = "assets/icons/dashboard-fill.svg";
"assets/icons/dashboard-fill.svg";
/// Assets for assetsIconsDevices /// Assets for assetsIconsDevices
/// assets/icons/Devices.svg /// assets/icons/Devices.svg
@ -274,8 +244,7 @@ class Assets {
/// Assets for assetsIconsDoorLockLinkage /// Assets for assetsIconsDoorLockLinkage
/// assets/icons/DoorLockLinkage.svg /// assets/icons/DoorLockLinkage.svg
static const String assetsIconsDoorLockLinkage = static const String assetsIconsDoorLockLinkage = "assets/icons/DoorLockLinkage.svg";
"assets/icons/DoorLockLinkage.svg";
/// Assets for assetsIconsDoorLockLock /// Assets for assetsIconsDoorLockLock
/// assets/icons/DoorLockLock.svg /// assets/icons/DoorLockLock.svg
@ -283,18 +252,15 @@ class Assets {
/// Assets for assetsIconsDoorLockMembers /// Assets for assetsIconsDoorLockMembers
/// assets/icons/DoorLockMembers.svg /// assets/icons/DoorLockMembers.svg
static const String assetsIconsDoorLockMembers = static const String assetsIconsDoorLockMembers = "assets/icons/DoorLockMembers.svg";
"assets/icons/DoorLockMembers.svg";
/// Assets for assetsIconsDoorLockPassword /// Assets for assetsIconsDoorLockPassword
/// assets/icons/DoorLockPassword.svg /// assets/icons/DoorLockPassword.svg
static const String assetsIconsDoorLockPassword = static const String assetsIconsDoorLockPassword = "assets/icons/DoorLockPassword.svg";
"assets/icons/DoorLockPassword.svg";
/// Assets for assetsIconsDoorLockRecords /// Assets for assetsIconsDoorLockRecords
/// assets/icons/DoorLockRecords.svg /// assets/icons/DoorLockRecords.svg
static const String assetsIconsDoorLockRecords = static const String assetsIconsDoorLockRecords = "assets/icons/DoorLockRecords.svg";
"assets/icons/DoorLockRecords.svg";
/// Assets for assetsIconsDoorlockAssetsBatteryIndicator /// Assets for assetsIconsDoorlockAssetsBatteryIndicator
/// assets/icons/doorlock-assets/BatteryIndicator.svg /// assets/icons/doorlock-assets/BatteryIndicator.svg
@ -315,8 +281,7 @@ class Assets {
/// assets/icons/doorlock-assets/lockIcon.svg /// assets/icons/doorlock-assets/lockIcon.svg
static const String assetsIconsDoorlockAssetsLockIcon = static const String assetsIconsDoorlockAssetsLockIcon =
"assets/icons/doorlock-assets/lockIcon.svg"; "assets/icons/doorlock-assets/lockIcon.svg";
static const String doorUnlockIcon = static const String doorUnlockIcon = "assets/icons/doorlock-assets/door_un_look_ic.svg";
"assets/icons/doorlock-assets/door_un_look_ic.svg";
/// Assets for assetsIconsDoorlockAssetsMembersManagement /// Assets for assetsIconsDoorlockAssetsMembersManagement
/// assets/icons/doorlock-assets/members-management.svg /// assets/icons/doorlock-assets/members-management.svg
@ -404,13 +369,11 @@ class Assets {
/// Assets for assetsIconsLightSwitchOff /// Assets for assetsIconsLightSwitchOff
/// assets/icons/lightSwitchOff.svg /// assets/icons/lightSwitchOff.svg
static const String assetsIconsLightSwitchOff = static const String assetsIconsLightSwitchOff = "assets/icons/lightSwitchOff.svg";
"assets/icons/lightSwitchOff.svg";
/// Assets for assetsIconsLightSwitchOn /// Assets for assetsIconsLightSwitchOn
/// assets/icons/lightSwitchOn.svg /// assets/icons/lightSwitchOn.svg
static const String assetsIconsLightSwitchOn = static const String assetsIconsLightSwitchOn = "assets/icons/lightSwitchOn.svg";
"assets/icons/lightSwitchOn.svg";
/// Assets for assetsIconsLinkageIconsDoorLockAlarm /// Assets for assetsIconsLinkageIconsDoorLockAlarm
/// assets/icons/linkageIcons/doorLockAlarm.svg /// assets/icons/linkageIcons/doorLockAlarm.svg
@ -419,8 +382,7 @@ class Assets {
/// Assets for assetsIconsLinkTimeLimitedPasswordIcon /// Assets for assetsIconsLinkTimeLimitedPasswordIcon
/// assets/icons/timeLimitedPasswordIcon.svg /// assets/icons/timeLimitedPasswordIcon.svg
static const String timeLimitedPasswordIcon = static const String timeLimitedPasswordIcon = "assets/icons/timeLimitedPasswordIcon.svg";
"assets/icons/timeLimitedPasswordIcon.svg";
/// Assets for assetsIconsoneTimePassword /// Assets for assetsIconsoneTimePassword
/// assets/icons/oneTimePassword.svg /// assets/icons/oneTimePassword.svg
@ -428,8 +390,7 @@ class Assets {
/// Assets for assetsIconsTimeLimitedPassword /// Assets for assetsIconsTimeLimitedPassword
/// assets/icons/timeLimitedPassword.svg /// assets/icons/timeLimitedPassword.svg
static const String timeLimitedPassword = static const String timeLimitedPassword = "assets/icons/timeLimitedPassword.svg";
"assets/icons/timeLimitedPassword.svg";
/// Assets for assetsIconsNoValidPasswords /// Assets for assetsIconsNoValidPasswords
/// assets/icons/noValidPasswords.svg /// assets/icons/noValidPasswords.svg
@ -598,13 +559,11 @@ class Assets {
/// Assets for assetsIconsPresenceSensorAssetsParameterSettings /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
/// assets/icons/presence-sensor-assets/space_type_icon.svg /// assets/icons/presence-sensor-assets/space_type_icon.svg
static const String spaceTypeIcon = static const String spaceTypeIcon = "assets/icons/presence-sensor-assets/space_type_icon.svg";
"assets/icons/presence-sensor-assets/space_type_icon.svg";
/// Assets for assetsIconsPresenceSensorAssetsParameterSettings /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
/// assets/icons/presence-sensor-assets/space_type_icon.svg /// assets/icons/presence-sensor-assets/space_type_icon.svg
static const String sensitivityIcon = static const String sensitivityIcon = "assets/icons/presence-sensor-assets/Sensitivity.svg";
"assets/icons/presence-sensor-assets/Sensitivity.svg";
/// Assets for assetsIconsPresenceSensorAssetsParameterSettings /// Assets for assetsIconsPresenceSensorAssetsParameterSettings
/// assets/icons/presence-sensor-assets/maximum_distance.svg /// assets/icons/presence-sensor-assets/maximum_distance.svg
@ -637,8 +596,7 @@ class Assets {
/// Assets for assetsIconsRoutinesFill /// Assets for assetsIconsRoutinesFill
/// assets/icons/Routines-fill.svg /// assets/icons/Routines-fill.svg
static const String assetsIconsRoutinesFill = static const String assetsIconsRoutinesFill = "assets/icons/Routines-fill.svg";
"assets/icons/Routines-fill.svg";
/// Assets for assetsIconsScan /// Assets for assetsIconsScan
/// assets/icons/Scan.svg /// assets/icons/Scan.svg
@ -670,8 +628,7 @@ class Assets {
/// Assets for assetsIconsSustainability /// Assets for assetsIconsSustainability
/// assets/icons/sustainability.svg /// assets/icons/sustainability.svg
static const String assetsIconsSustainability = static const String assetsIconsSustainability = "assets/icons/sustainability.svg";
"assets/icons/sustainability.svg";
/// Assets for assetsIconsUnlockingMethodsIconsFace /// Assets for assetsIconsUnlockingMethodsIconsFace
/// assets/icons/unlockingMethodsIcons/face.svg /// assets/icons/unlockingMethodsIcons/face.svg
@ -767,8 +724,7 @@ class Assets {
/// Assets for assetsImagesHorizintalBlade /// Assets for assetsImagesHorizintalBlade
/// assets/images/HorizintalBlade.png /// assets/images/HorizintalBlade.png
static const String assetsImagesHorizintalBlade = static const String assetsImagesHorizintalBlade = "assets/images/HorizintalBlade.png";
"assets/images/HorizintalBlade.png";
/// Assets for assetsImagesLogo /// Assets for assetsImagesLogo
/// assets/images/Logo.svg /// assets/images/Logo.svg
@ -776,8 +732,7 @@ class Assets {
/// Assets for assetsImagesLogoHorizontal /// Assets for assetsImagesLogoHorizontal
/// assets/images/logo_horizontal.png /// assets/images/logo_horizontal.png
static const String assetsImagesLogoHorizontal = static const String assetsImagesLogoHorizontal = "assets/images/logo_horizontal.png";
"assets/images/logo_horizontal.png";
/// Assets for assetsImagesPause /// Assets for assetsImagesPause
/// assets/images/Pause.png /// assets/images/Pause.png
@ -807,8 +762,7 @@ class Assets {
/// assets/images/Window.png /// assets/images/Window.png
static const String assetsImagesWindow = "assets/images/Window.png"; static const String assetsImagesWindow = "assets/images/Window.png";
static const String assetsSensitivityFunction = static const String assetsSensitivityFunction = "assets/icons/functions_icons/sensitivity.svg";
"assets/icons/functions_icons/sensitivity.svg";
//assets/icons/functions_icons/sesitivity_operation_icon.svg //assets/icons/functions_icons/sesitivity_operation_icon.svg
static const String assetsSensitivityOperationIcon = static const String assetsSensitivityOperationIcon =
@ -816,73 +770,59 @@ class Assets {
//assets/icons/functions_icons/ac_power.svg //assets/icons/functions_icons/ac_power.svg
static const String assetsAcPower = static const String assetsAcPower = "assets/icons/functions_icons/ac_power.svg";
"assets/icons/functions_icons/ac_power.svg";
//assets/icons/functions_icons/ac_power_off.svg //assets/icons/functions_icons/ac_power_off.svg
static const String assetsAcPowerOFF = static const String assetsAcPowerOFF = "assets/icons/functions_icons/ac_power_off.svg";
"assets/icons/functions_icons/ac_power_off.svg";
//assets/icons/functions_icons/child_lock.svg //assets/icons/functions_icons/child_lock.svg
static const String assetsChildLock = static const String assetsChildLock = "assets/icons/functions_icons/child_lock.svg";
"assets/icons/functions_icons/child_lock.svg";
//assets/icons/functions_icons/cooling.svg //assets/icons/functions_icons/cooling.svg
static const String assetsFreezing = static const String assetsFreezing = "assets/icons/functions_icons/freezing.svg";
"assets/icons/functions_icons/freezing.svg";
//assets/icons/functions_icons/fan_speed.svg //assets/icons/functions_icons/fan_speed.svg
static const String assetsFanSpeed = static const String assetsFanSpeed = "assets/icons/functions_icons/fan_speed.svg";
"assets/icons/functions_icons/fan_speed.svg";
//assets/icons/functions_icons/ac_cooling.svg //assets/icons/functions_icons/ac_cooling.svg
static const String assetsAcCooling = static const String assetsAcCooling = "assets/icons/functions_icons/ac_cooling.svg";
"assets/icons/functions_icons/ac_cooling.svg";
//assets/icons/functions_icons/ac_heating.svg //assets/icons/functions_icons/ac_heating.svg
static const String assetsAcHeating = static const String assetsAcHeating = "assets/icons/functions_icons/ac_heating.svg";
"assets/icons/functions_icons/ac_heating.svg";
//assets/icons/functions_icons/celsius_degrees.svg //assets/icons/functions_icons/celsius_degrees.svg
static const String assetsCelsiusDegrees = static const String assetsCelsiusDegrees = "assets/icons/functions_icons/celsius_degrees.svg";
"assets/icons/functions_icons/celsius_degrees.svg";
//assets/icons/functions_icons/tempreture.svg //assets/icons/functions_icons/tempreture.svg
static const String assetsTempreture = static const String assetsTempreture = "assets/icons/functions_icons/tempreture.svg";
"assets/icons/functions_icons/tempreture.svg";
//assets/icons/functions_icons/ac_fan_low.svg //assets/icons/functions_icons/ac_fan_low.svg
static const String assetsAcFanLow = static const String assetsAcFanLow = "assets/icons/functions_icons/ac_fan_low.svg";
"assets/icons/functions_icons/ac_fan_low.svg";
//assets/icons/functions_icons/ac_fan_middle.svg //assets/icons/functions_icons/ac_fan_middle.svg
static const String assetsAcFanMiddle = static const String assetsAcFanMiddle = "assets/icons/functions_icons/ac_fan_middle.svg";
"assets/icons/functions_icons/ac_fan_middle.svg";
//assets/icons/functions_icons/ac_fan_high.svg //assets/icons/functions_icons/ac_fan_high.svg
static const String assetsAcFanHigh = static const String assetsAcFanHigh = "assets/icons/functions_icons/ac_fan_high.svg";
"assets/icons/functions_icons/ac_fan_high.svg";
//assets/icons/functions_icons/ac_fan_auto.svg //assets/icons/functions_icons/ac_fan_auto.svg
static const String assetsAcFanAuto = static const String assetsAcFanAuto = "assets/icons/functions_icons/ac_fan_auto.svg";
"assets/icons/functions_icons/ac_fan_auto.svg";
//assets/icons/functions_icons/scene_child_lock.svg //assets/icons/functions_icons/scene_child_lock.svg
static const String assetsSceneChildLock = static const String assetsSceneChildLock = "assets/icons/functions_icons/scene_child_lock.svg";
"assets/icons/functions_icons/scene_child_lock.svg";
//assets/icons/functions_icons/scene_child_unlock.svg //assets/icons/functions_icons/scene_child_unlock.svg
@ -891,18 +831,15 @@ class Assets {
//assets/icons/functions_icons/scene_refresh.svg //assets/icons/functions_icons/scene_refresh.svg
static const String assetsSceneRefresh = static const String assetsSceneRefresh = "assets/icons/functions_icons/scene_refresh.svg";
"assets/icons/functions_icons/scene_refresh.svg";
//assets/icons/functions_icons/light_countdown.svg //assets/icons/functions_icons/light_countdown.svg
static const String assetsLightCountdown = static const String assetsLightCountdown = "assets/icons/functions_icons/light_countdown.svg";
"assets/icons/functions_icons/light_countdown.svg";
//assets/icons/functions_icons/far_detection.svg //assets/icons/functions_icons/far_detection.svg
static const String assetsFarDetection = static const String assetsFarDetection = "assets/icons/functions_icons/far_detection.svg";
"assets/icons/functions_icons/far_detection.svg";
//assets/icons/functions_icons/far_detection_function.svg //assets/icons/functions_icons/far_detection_function.svg
@ -911,13 +848,11 @@ class Assets {
//assets/icons/functions_icons/indicator.svg //assets/icons/functions_icons/indicator.svg
static const String assetsIndicator = static const String assetsIndicator = "assets/icons/functions_icons/indicator.svg";
"assets/icons/functions_icons/indicator.svg";
//assets/icons/functions_icons/motion_detection.svg //assets/icons/functions_icons/motion_detection.svg
static const String assetsMotionDetection = static const String assetsMotionDetection = "assets/icons/functions_icons/motion_detection.svg";
"assets/icons/functions_icons/motion_detection.svg";
//assets/icons/functions_icons/motionless_detection.svg //assets/icons/functions_icons/motionless_detection.svg
@ -926,18 +861,15 @@ class Assets {
//assets/icons/functions_icons/nobody_time.svg //assets/icons/functions_icons/nobody_time.svg
static const String assetsNobodyTime = static const String assetsNobodyTime = "assets/icons/functions_icons/nobody_time.svg";
"assets/icons/functions_icons/nobody_time.svg";
//assets/icons/functions_icons/factory_reset.svg //assets/icons/functions_icons/factory_reset.svg
static const String assetsFactoryReset = static const String assetsFactoryReset = "assets/icons/functions_icons/factory_reset.svg";
"assets/icons/functions_icons/factory_reset.svg";
//assets/icons/functions_icons/master_state.svg //assets/icons/functions_icons/master_state.svg
static const String assetsMasterState = static const String assetsMasterState = "assets/icons/functions_icons/master_state.svg";
"assets/icons/functions_icons/master_state.svg";
//assets/icons/functions_icons/switch_alarm_sound.svg //assets/icons/functions_icons/switch_alarm_sound.svg
@ -946,8 +878,7 @@ class Assets {
//assets/icons/functions_icons/reset_off.svg //assets/icons/functions_icons/reset_off.svg
static const String assetsResetOff = static const String assetsResetOff = "assets/icons/functions_icons/reset_off.svg";
"assets/icons/functions_icons/reset_off.svg";
//assets/icons/functions_icons/automation_functions/card_unlock.svg //assets/icons/functions_icons/automation_functions/card_unlock.svg
@ -1021,8 +952,7 @@ class Assets {
//assets/icons/functions_icons/automation_functions/motion.svg //assets/icons/functions_icons/automation_functions/motion.svg
static const String assetsMotion = static const String assetsMotion = "assets/icons/functions_icons/automation_functions/motion.svg";
"assets/icons/functions_icons/automation_functions/motion.svg";
//assets/icons/functions_icons/automation_functions/current_temp.svg //assets/icons/functions_icons/automation_functions/current_temp.svg
@ -1044,19 +974,15 @@ class Assets {
static const String waterHeaterOn = "assets/icons/water_heater_on.svg"; static const String waterHeaterOn = "assets/icons/water_heater_on.svg";
static const String waterHeaterOff = "assets/icons/water_heater_off.svg"; static const String waterHeaterOff = "assets/icons/water_heater_off.svg";
static const String scheduleCelenderIcon = static const String scheduleCelenderIcon = "assets/icons/schedule_celender_icon.svg";
"assets/icons/schedule_celender_icon.svg"; static const String scheduleCirculateIcon = "assets/icons/schedule_circulate_icon.svg";
static const String scheduleCirculateIcon = static const String scheduleInchingIcon = "assets/icons/schedule_Inching_icon.svg";
"assets/icons/schedule_circulate_icon.svg";
static const String scheduleInchingIcon =
"assets/icons/schedule_Inching_icon.svg";
static const String scheduleTimeIcon = "assets/icons/schedule_time_icon.svg"; static const String scheduleTimeIcon = "assets/icons/schedule_time_icon.svg";
static const String waterHeaterIcon = "assets/icons/water_heater_icon.svg"; static const String waterHeaterIcon = "assets/icons/water_heater_icon.svg";
static const String doorOpen = "assets/icons/opened_door.svg"; static const String doorOpen = "assets/icons/opened_door.svg";
static const String doorClose = "assets/icons/closed_door.svg"; static const String doorClose = "assets/icons/closed_door.svg";
static const String doorNotificationSetting = static const String doorNotificationSetting = "assets/icons/door_notification_setting_icon.svg";
"assets/icons/door_notification_setting_icon.svg";
static const String doorRecordsIcon = "assets/icons/door_records_icon.svg"; static const String doorRecordsIcon = "assets/icons/door_records_icon.svg";
static const String doorSensorIcon = "assets/icons/door_sensor_icon.svg"; static const String doorSensorIcon = "assets/icons/door_sensor_icon.svg";
static const String closedGarageIcon = "assets/icons/closed_garage_door.svg"; static const String closedGarageIcon = "assets/icons/closed_garage_door.svg";

View File

@ -30,7 +30,7 @@ void main() {
// }); // });
//to initialize the locator //to initialize the locator
initialSetup(envName: 'prod'); initialSetup();
await Firebase.initializeApp( await Firebase.initializeApp(
options: DefaultFirebaseOptionsStaging.currentPlatform, options: DefaultFirebaseOptionsStaging.currentPlatform,

View File

@ -30,7 +30,7 @@ void main() {
// }); // });
//to initialize the locator //to initialize the locator
initialSetup(envName: 'dev'); initialSetup();
await Firebase.initializeApp( await Firebase.initializeApp(
options: DefaultFirebaseOptionsDev.currentPlatform, options: DefaultFirebaseOptionsDev.currentPlatform,

View File

@ -5,9 +5,8 @@ import 'package:syncrow_app/services/api/http_service.dart';
final GetIt serviceLocator = GetIt.instance; final GetIt serviceLocator = GetIt.instance;
// setupLocator() // to search for dependency injection in flutter // setupLocator() // to search for dependency injection in flutter
initialSetup({required String envName}) { initialSetup() {
serviceLocator.registerSingleton<HTTPInterceptor>(HTTPInterceptor()); serviceLocator.registerSingleton<HTTPInterceptor>(HTTPInterceptor());
//Base classes //Base classes
serviceLocator.registerSingleton<Dio>(HTTPService.setupDioClient()); serviceLocator.registerSingleton<Dio>(HTTPService.setupDioClient());
serviceLocator.registerSingleton<String>(envName);
} }