formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions

View File

@ -4,7 +4,8 @@ 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});
@ -43,7 +44,7 @@ class DeviceBatchControlDialog extends StatelessWidget with RouteControlsBasedCo
height: 8,
),
Text(
"Batch Control",
'Batch Control',
style: context.textTheme.bodySmall!.copyWith(
color: ColorsManager.dialogBlueTitle,
),
@ -104,39 +105,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: EdgeInsets.all(1),
padding: const 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,8 +18,9 @@ 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,7 +4,10 @@ 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;
@ -32,7 +35,9 @@ 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),
),
),
],
@ -40,7 +45,9 @@ 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/utils/constants/assets.dart';
import 'package:syncrow_web/utils/extension/build_context_x.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/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';
class PresenceSpaceType extends StatelessWidget {
const PresenceSpaceType({
@ -20,7 +20,7 @@ class PresenceSpaceType extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Map<SpaceTypes, String> spaceTypeIcons = {
final spaceTypeIcons = <SpaceTypes, String>{
SpaceTypes.none: Assets.office,
SpaceTypes.parlour: Assets.parlour,
SpaceTypes.area: Assets.dyi,

View File

@ -4,7 +4,8 @@ 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;
@ -23,7 +24,9 @@ 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,7 +25,9 @@ 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),
),
],
),
@ -41,7 +43,9 @@ 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(r'[a-zA-Z]'), '').trim();
return value.replaceAll(RegExp('[a-zA-Z]'), '').trim();
}
String _extractUnit(String value) {
@ -69,17 +69,17 @@ class _PresenceUpdateDataState extends State<PresenceNoBodyTime> {
}
void _incrementValue() {
int currentIndex = nobodyTimeRange.indexOf(_currentValue);
final currentIndex = nobodyTimeRange.indexOf(_currentValue);
if (currentIndex < nobodyTimeRange.length - 1) {
String newValue = nobodyTimeRange[currentIndex + 1];
final newValue = nobodyTimeRange[currentIndex + 1];
_onValueChanged(newValue);
}
}
void _decrementValue() {
int currentIndex = nobodyTimeRange.indexOf(_currentValue);
final currentIndex = nobodyTimeRange.indexOf(_currentValue);
if (currentIndex > 0) {
String newValue = nobodyTimeRange[currentIndex - 1];
final newValue = nobodyTimeRange[currentIndex - 1];
_onValueChanged(newValue);
}
}

View File

@ -41,7 +41,8 @@ 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(
@ -49,7 +50,8 @@ 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(),
@ -66,28 +68,36 @@ class ReportsTable extends StatelessWidget {
),
if (report.data != null)
...report.data!.asMap().entries.map((entry) {
int index = entry.key;
DeviceEvent data = entry.value;
final index = entry.key;
final data = entry.value;
// Parse eventTime into Date and Time
DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch(data.eventTime!);
String date = DateFormat('dd/MM/yyyy').format(eventDateTime);
String time = DateFormat('HH:mm').format(eventDateTime);
final eventDateTime =
DateTime.fromMillisecondsSinceEpoch(
data.eventTime!);
final date =
DateFormat('dd/MM/yyyy').format(eventDateTime);
final 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,29 +42,30 @@ class ToggleWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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 (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,
),
)),
if (showToggle)
Container(
child: CupertinoSwitch(
value: value,
activeColor: ColorsManager.dialogBlueTitle,
activeTrackColor: ColorsManager.dialogBlueTitle,
onChanged: onChange,
),
),