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

@ -4,8 +4,7 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_mo
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';
class DeviceBatchControlDialog extends StatelessWidget
with RouteControlsBasedCode {
class DeviceBatchControlDialog extends StatelessWidget with RouteControlsBasedCode {
final List<AllDevicesModel> devices;
const DeviceBatchControlDialog({super.key, required this.devices});
@ -44,7 +43,7 @@ class DeviceBatchControlDialog extends StatelessWidget
height: 8,
),
Text(
'Batch Control',
"Batch Control",
style: context.textTheme.bodySmall!.copyWith(
color: ColorsManager.dialogBlueTitle,
),
@ -105,39 +104,39 @@ String getBatchDialogName(AllDevicesModel device) {
*/
switch (device.productType) {
case '1G':
return 'Smart Light Switch';
return "Smart Light Switch";
case '2G':
return 'Smart Light Switch';
return "Smart Light Switch";
case '3G':
return 'Smart Light Switch';
return "Smart Light Switch";
case 'GW':
return 'Gateway';
return "Gateway";
case 'DL':
return 'Door Lock';
return "Door Lock";
case 'WPS':
return 'White Presence Sensor';
return "White Presence Sensor";
case 'CPS':
return 'Black Presence Sensor';
return "Black Presence Sensor";
case 'CUR':
return 'Smart Curtains';
return "Smart Curtains";
case 'WH':
return 'Smart Water Heater';
return "Smart Water Heater";
case 'AC':
return 'Smart AC';
return "Smart AC";
case 'DS':
return 'Door / Window Sensor';
return "Door / Window Sensor";
case '1GT':
return 'Touch Switch';
return "Touch Switch";
case '2GT':
return 'Touch Switch';
return "Touch Switch";
case '3GT':
return 'Touch Switch';
return "Touch Switch";
case 'GD':
return 'Garage Door Opener';
return "Garage Door Opener";
case 'WL':
return 'Water Leak Sensor';
return "Water Leak Sensor";
case 'SOS':
return 'SOS';
return "SOS";
default:
return device.categoryName ?? 'Device Control';
}

View File

@ -50,7 +50,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
),
),
child: IconButton(
padding: const EdgeInsets.all(1),
padding: EdgeInsets.all(1),
icon: const Icon(
Icons.close,
color: Colors.grey,
@ -107,7 +107,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
'Installation Date and Time:',
formatDateTime(
DateTime.fromMillisecondsSinceEpoch(
(device.createTime ?? 0) * 1000,
((device.createTime ?? 0) * 1000),
),
),
),
@ -115,7 +115,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
'Battery Level:',
device.batteryLevel != null
? '${device.batteryLevel ?? 0}%'
: '-',
: "-",
statusColor: device.batteryLevel != null
? (device.batteryLevel! < 20
? ColorsManager.red
@ -131,7 +131,7 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
'Last Offline Date and Time:',
formatDateTime(
DateTime.fromMillisecondsSinceEpoch(
(device.updateTime ?? 0) * 1000,
((device.updateTime ?? 0) * 1000),
),
),
),

View File

@ -18,9 +18,8 @@ class DeviceControlsContainer extends StatelessWidget {
color: Colors.grey.shade100,
borderRadius: BorderRadius.circular(20),
),
padding: EdgeInsets.symmetric(
vertical: padding ?? 10,
horizontal: padding ?? 16), //EdgeInsets.all(padding ?? 12),
padding:
EdgeInsets.symmetric(vertical: padding ?? 10, horizontal: padding ?? 16), //EdgeInsets.all(padding ?? 12),
child: child,
),
);

View File

@ -4,10 +4,7 @@ import 'package:syncrow_web/utils/color_manager.dart';
class PresenceDisplayValue extends StatelessWidget {
const PresenceDisplayValue(
{super.key,
required this.value,
required this.postfix,
required this.description});
{super.key, required this.value, required this.postfix, required this.description});
final String value;
final String postfix;
@ -35,9 +32,7 @@ class PresenceDisplayValue extends StatelessWidget {
child: Text(
postfix,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.blackColor,
fontSize: 16,
fontWeight: FontWeight.w700),
color: ColorsManager.blackColor, fontSize: 16, fontWeight: FontWeight.w700),
),
),
],
@ -45,9 +40,7 @@ class PresenceDisplayValue extends StatelessWidget {
Text(
description,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.blackColor,
fontWeight: FontWeight.w400,
fontSize: 16),
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 16),
),
],
),

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart';
class PresenceSpaceType extends StatelessWidget {
const PresenceSpaceType({
@ -20,7 +20,7 @@ class PresenceSpaceType extends StatelessWidget {
@override
Widget build(BuildContext context) {
final spaceTypeIcons = <SpaceTypes, String>{
final Map<SpaceTypes, String> spaceTypeIcons = {
SpaceTypes.none: Assets.office,
SpaceTypes.parlour: Assets.parlour,
SpaceTypes.area: Assets.dyi,

View File

@ -4,8 +4,7 @@ import 'package:syncrow_web/pages/device_managment/shared/device_controls_contai
import 'package:syncrow_web/utils/color_manager.dart';
class PresenceStaticWidget extends StatelessWidget {
const PresenceStaticWidget(
{required this.icon, required this.description, super.key});
const PresenceStaticWidget({required this.icon, required this.description, super.key});
final String icon;
final String description;
@ -24,9 +23,7 @@ class PresenceStaticWidget extends StatelessWidget {
Text(
description,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.blackColor,
fontWeight: FontWeight.w400,
fontSize: 16),
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 16),
),
],
),

View File

@ -25,9 +25,7 @@ class PresenceState extends StatelessWidget {
Text(
'Status:',
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.blackColor,
fontWeight: FontWeight.w400,
fontSize: 10),
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 10),
),
],
),
@ -43,9 +41,7 @@ class PresenceState extends StatelessWidget {
Text(
value,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.blackColor,
fontWeight: FontWeight.w400,
fontSize: 16),
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 16),
),
],
),

View File

@ -48,7 +48,7 @@ class _PresenceUpdateDataState extends State<PresenceNoBodyTime> {
String _extractNumericValue(String value) {
if (value == 'none') return '0';
return value.replaceAll(RegExp('[a-zA-Z]'), '').trim();
return value.replaceAll(RegExp(r'[a-zA-Z]'), '').trim();
}
String _extractUnit(String value) {
@ -69,17 +69,17 @@ class _PresenceUpdateDataState extends State<PresenceNoBodyTime> {
}
void _incrementValue() {
final currentIndex = nobodyTimeRange.indexOf(_currentValue);
int currentIndex = nobodyTimeRange.indexOf(_currentValue);
if (currentIndex < nobodyTimeRange.length - 1) {
final newValue = nobodyTimeRange[currentIndex + 1];
String newValue = nobodyTimeRange[currentIndex + 1];
_onValueChanged(newValue);
}
}
void _decrementValue() {
final currentIndex = nobodyTimeRange.indexOf(_currentValue);
int currentIndex = nobodyTimeRange.indexOf(_currentValue);
if (currentIndex > 0) {
final newValue = nobodyTimeRange[currentIndex - 1];
String newValue = nobodyTimeRange[currentIndex - 1];
_onValueChanged(newValue);
}
}

View File

@ -41,8 +41,7 @@ class ReportsTable extends StatelessWidget {
height: 100,
child: Text(
'No reports found',
style: context.textTheme.bodyLarge!
.copyWith(color: ColorsManager.grayColor),
style: context.textTheme.bodyLarge!.copyWith(color: ColorsManager.grayColor),
),
)
: Stack(
@ -50,8 +49,7 @@ class ReportsTable extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(20.0),
child: Table(
border:
TableBorder.all(color: Colors.grey.shade300, width: 1),
border: TableBorder.all(color: Colors.grey.shade300, width: 1),
columnWidths: const {
0: FlexColumnWidth(),
1: FlexColumnWidth(),
@ -68,36 +66,28 @@ class ReportsTable extends StatelessWidget {
),
if (report.data != null)
...report.data!.asMap().entries.map((entry) {
final index = entry.key;
final data = entry.value;
int index = entry.key;
DeviceEvent data = entry.value;
// Parse eventTime into Date and Time
final eventDateTime =
DateTime.fromMillisecondsSinceEpoch(
data.eventTime!);
final date =
DateFormat('dd/MM/yyyy').format(eventDateTime);
final time = DateFormat('HH:mm').format(eventDateTime);
DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch(data.eventTime!);
String date = DateFormat('dd/MM/yyyy').format(eventDateTime);
String time = DateFormat('HH:mm').format(eventDateTime);
String value;
if (hideValueShowDescription == true) {
if (mainDoorSensor != null &&
mainDoorSensor == true) {
if (mainDoorSensor != null && mainDoorSensor == true) {
value = data.value == 'true' ? 'Open' : 'Close';
} else if (garageDoorSensor != null &&
garageDoorSensor == true) {
} else if (garageDoorSensor != null && garageDoorSensor == true) {
value = data.value == 'true' ? 'Opened' : 'Closed';
} else if (waterLeak != null && waterLeak == true) {
value = data.value == 'normal'
? 'Normal'
: 'Leak Detected';
value = data.value == 'normal' ? 'Normal' : 'Leak Detected';
} else {
value =
'${data.value!} ${thirdColumnDescription ?? ''}';
value = '${data.value!} ${thirdColumnDescription ?? ''}';
}
} else {
value =
'${data.value!} ${thirdColumnDescription ?? ''}';
value = '${data.value!} ${thirdColumnDescription ?? ''}';
}
return TableRow(

View File

@ -42,30 +42,29 @@ class ToggleWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (icon == '-1')
const SizedBox(
height: 60,
width: 60,
)
else
ClipOval(
child: Container(
height: 60,
width: 60,
padding: const EdgeInsets.all(8),
color: ColorsManager.whiteColors,
child: SvgPicture.asset(
icon ?? Assets.lightPulp,
width: 35,
height: 35,
fit: BoxFit.contain,
),
)),
icon == '-1'
? const SizedBox(
height: 60,
width: 60,
)
: ClipOval(
child: Container(
height: 60,
width: 60,
padding: const EdgeInsets.all(8),
color: ColorsManager.whiteColors,
child: SvgPicture.asset(
icon ?? Assets.lightPulp,
width: 35,
height: 35,
fit: BoxFit.contain,
),
)),
if (showToggle)
Container(
child: CupertinoSwitch(
value: value,
activeTrackColor: ColorsManager.dialogBlueTitle,
activeColor: ColorsManager.dialogBlueTitle,
onChanged: onChange,
),
),