Revert "formatted all files."

This reverts commit 04250ebc98.
This commit is contained in:
Faris Armoush
2025-06-12 16:04:49 +03:00
parent 218f43bacb
commit c642ba2644
473 changed files with 4335 additions and 5417 deletions

View File

@ -22,8 +22,7 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
late SosStatusModel deviceStatus;
FutureOr<void> _getDeviceStatus(
GetDeviceStatus event, Emitter<SosDeviceState> emit) async {
FutureOr<void> _getDeviceStatus(GetDeviceStatus event, Emitter<SosDeviceState> emit) async {
emit(SosDeviceLoadingState());
try {
final status = await DevicesManagementApi().getDeviceStatus(event.uuid);
@ -34,8 +33,7 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
}
}
FutureOr<void> _getBatchStatus(
GetBatchStatus event, Emitter<SosDeviceState> emit) async {
FutureOr<void> _getBatchStatus(GetBatchStatus event, Emitter<SosDeviceState> emit) async {
emit(SosDeviceLoadingState());
try {
final status = await DevicesManagementApi().getBatchStatus(event.uuids);
@ -46,31 +44,25 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
}
}
FutureOr<void> _getDeviceRecords(
GetDeviceRecords event, Emitter<SosDeviceState> emit) async {
FutureOr<void> _getDeviceRecords(GetDeviceRecords event, Emitter<SosDeviceState> emit) async {
emit(SosReportLoadingState());
try {
final from = DateTime.now()
.subtract(const Duration(days: 30))
.millisecondsSinceEpoch;
final from = DateTime.now().subtract(const Duration(days: 30)).millisecondsSinceEpoch;
final to = DateTime.now().millisecondsSinceEpoch;
final records = await DevicesManagementApi.getDeviceReportsByDate(
event.uuid, 'sos', from.toString(), to.toString());
final DeviceReport records =
await DevicesManagementApi.getDeviceReportsByDate(event.uuid, 'sos', from.toString(), to.toString());
emit(SosReportLoadedState(records));
} catch (e) {
emit(SosReportErrorState(e.toString()));
}
}
FutureOr<void> _getDeviceAutomationRecords(
GetDeviceAutomationRecords event, Emitter<SosDeviceState> emit) async {
FutureOr<void> _getDeviceAutomationRecords(GetDeviceAutomationRecords event, Emitter<SosDeviceState> emit) async {
emit(SosAutomationReportLoadingState());
try {
final from = DateTime.now()
.subtract(const Duration(days: 30))
.millisecondsSinceEpoch;
final from = DateTime.now().subtract(const Duration(days: 30)).millisecondsSinceEpoch;
final to = DateTime.now().millisecondsSinceEpoch;
final records = await DevicesManagementApi.getDeviceReportsByDate(
final DeviceReport records = await DevicesManagementApi.getDeviceReportsByDate(
event.uuid, 'sos_automation', from.toString(), to.toString());
emit(SosAutomationReportLoadedState(records));
} catch (e) {
@ -78,17 +70,14 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
}
}
FutureOr<void> _backToSosStatusView(
BackToSosStatusView event, Emitter<SosDeviceState> emit) {
FutureOr<void> _backToSosStatusView(BackToSosStatusView event, Emitter<SosDeviceState> emit) {
emit(SosDeviceLoadedState(deviceStatus));
}
FutureOr<void> _sosFactoryReset(
SosFactoryReset event, Emitter<SosDeviceState> emit) async {
FutureOr<void> _sosFactoryReset(SosFactoryReset event, Emitter<SosDeviceState> emit) async {
emit(SosDeviceLoadingState());
try {
final response = await DevicesManagementApi()
.factoryReset(event.factoryReset, event.deviceId);
final response = await DevicesManagementApi().factoryReset(event.factoryReset, event.deviceId);
if (response) {
emit(SosDeviceLoadedState(deviceStatus));
} else {

View File

@ -15,7 +15,7 @@ class SosStatusModel {
late int batteryLevel;
late String sosStatus;
for (final status in statuses) {
for (var status in statuses) {
switch (status.code) {
case 'battery_percentage':
batteryLevel = status.value;

View File

@ -6,12 +6,13 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_mo
import 'package:syncrow_web/pages/device_managment/shared/icon_name_status_container.dart';
import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart';
import 'package:syncrow_web/pages/device_managment/sos/bloc/sos_device_bloc.dart';
import 'package:syncrow_web/pages/device_managment/sos/models/sos_status_model.dart';
import 'package:syncrow_web/pages/device_managment/sos/widgets/sos_notification_dialog.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
import '../models/sos_status_model.dart';
class SosDeviceControlsView extends StatelessWidget
with HelperResponsiveLayout {
const SosDeviceControlsView({
@ -55,9 +56,9 @@ class SosDeviceControlsView extends StatelessWidget
} else if (state is SosDeviceErrorState) {
return const Center(child: Text('Error fetching status'));
} else if (state is SosAutomationReportErrorState) {
return Center(child: Text('Error: ${state.message}'));
return Center(child: Text('Error: ${state.message.toString()}'));
} else if (state is SosReportErrorState) {
return Center(child: Text('Error: ${state.message}'));
return Center(child: Text('Error: ${state.message.toString()}'));
}
return const Center(child: CircularProgressIndicator());
},

View File

@ -52,7 +52,7 @@ class _NotificationDialogState extends State<SosNotificationDialog> {
),
),
child: IconButton(
padding: const EdgeInsets.all(1),
padding: EdgeInsets.all(1),
icon: const Icon(
Icons.close,
color: Colors.grey,