mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 18:16:21 +00:00
remove socket from water heater
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
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/foundation.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/one_touch_bloc/one_touch_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/one_touch_bloc/one_touch_state.dart';
|
||||||
@ -527,7 +528,7 @@ class OneTouchBloc extends Bloc<OneTouchEvent, OneTouchState> {
|
|||||||
oneTouchId,
|
oneTouchId,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print('Invalid statusSelected or optionSelected');
|
debugPrint('Invalid statusSelected or optionSelected');
|
||||||
}
|
}
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
final errorData = e.response!.data;
|
final errorData = e.response!.data;
|
||||||
|
@ -74,7 +74,7 @@ class WaterHeaterBloc extends Bloc<WaterHeaterEvent, WaterHeaterState> {
|
|||||||
statusModelList,
|
statusModelList,
|
||||||
);
|
);
|
||||||
emit(UpdateState(whModel: deviceStatus));
|
emit(UpdateState(whModel: deviceStatus));
|
||||||
_listenToChanges();
|
// _listenToChanges();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(WHFailedState(errorMessage: e.toString()));
|
emit(WHFailedState(errorMessage: e.toString()));
|
||||||
return;
|
return;
|
||||||
|
@ -2,6 +2,7 @@ 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/foundation.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/water_leak_bloc/water_leak_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/water_leak_bloc/water_leak_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/water_leak_bloc/water_leak_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/water_leak_bloc/water_leak_state.dart';
|
||||||
@ -142,7 +143,7 @@ class WaterLeakBloc extends Bloc<WaterLeakEvent, WaterLeakState> {
|
|||||||
// Handle error
|
// Handle error
|
||||||
emit(WaterLeakFailedState(errorMessage: errorMessage));
|
emit(WaterLeakFailedState(errorMessage: errorMessage));
|
||||||
|
|
||||||
print('Error fetching logs: ${errorMessage}');
|
debugPrint('Error fetching logs: ${errorMessage}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ class WaterLeakRecordsScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
|
class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
|
||||||
int _selectedIndex = 0; // Track the selected tab index
|
int _selectedIndex = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
@ -71,7 +70,7 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
|
|||||||
child: TabBar(
|
child: TabBar(
|
||||||
onTap: (value) {
|
onTap: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedIndex = value; // Update selected index
|
_selectedIndex = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
indicatorColor: Colors.white,
|
indicatorColor: Colors.white,
|
||||||
|
@ -36,7 +36,6 @@ class WaterLeakScreen extends StatelessWidget {
|
|||||||
} else if (state is UpdateState) {
|
} else if (state is UpdateState) {
|
||||||
model = state.waterSensor;
|
model = state.waterSensor;
|
||||||
}
|
}
|
||||||
print(model.batteryPercentage);
|
|
||||||
return state is WaterLeakLoadingState
|
return state is WaterLeakLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
@ -70,7 +69,6 @@ class WaterLeakScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// color: Colors.white.withOpacity(0.1),
|
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(890),
|
BorderRadius.circular(890),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
@ -179,7 +177,6 @@ class WaterLeakScreen extends StatelessWidget {
|
|||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
text: 'Notification Settings',
|
text: 'Notification Settings',
|
||||||
// doorLockButtons.keys.elementAt(index),
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -33,7 +33,6 @@ class DevicesAPI {
|
|||||||
static Future<Map<String, dynamic>> controlDevice(
|
static Future<Map<String, dynamic>> controlDevice(
|
||||||
DeviceControlModel controlModel, String deviceId) async {
|
DeviceControlModel controlModel, String deviceId) async {
|
||||||
try {
|
try {
|
||||||
print(controlModel.toJson());
|
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
||||||
body: controlModel.toJson(),
|
body: controlModel.toJson(),
|
||||||
@ -77,7 +76,7 @@ class DevicesAPI {
|
|||||||
.replaceAll('{deviceUuid}', deviceId),
|
.replaceAll('{deviceUuid}', deviceId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print(json);
|
print('json======${json}');
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -386,13 +385,11 @@ class DevicesAPI {
|
|||||||
String? code,
|
String? code,
|
||||||
bool? value,
|
bool? value,
|
||||||
}) async {
|
}) async {
|
||||||
print({"devicesUuid": devicesUuid, "code": code, "value": value});
|
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.controlBatch,
|
path: ApiEndpoints.controlBatch,
|
||||||
body: {"devicesUuid": devicesUuid, "code": code, "value": value},
|
body: {"devicesUuid": devicesUuid, "code": code, "value": value},
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('json===$json');
|
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user