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

@ -52,8 +52,7 @@ class AnalyticsDeviceDropdown extends StatelessWidget {
);
}
Widget _buildDevicesDropdown(
BuildContext context, AnalyticsDevicesState state) {
Widget _buildDevicesDropdown(BuildContext context, AnalyticsDevicesState state) {
final spaceUuid = state.selectedDevice?.spaceUuid;
return DropdownButton<AnalyticsDevice?>(
value: state.selectedDevice,

View File

@ -18,6 +18,7 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget {
Widget build(BuildContext context) {
return BarChart(
BarChartData(
gridData: EnergyManagementChartsHelper.gridData().copyWith(
checkToShowHorizontalLine: (value) => true,
horizontalInterval: 250,
@ -99,11 +100,11 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget {
}) {
final data = energyData;
final date = DateFormat('dd/MM/yyyy').format(data[group.x].date);
final phaseA = data[group.x].energyConsumedA;
final phaseB = data[group.x].energyConsumedB;
final phaseC = data[group.x].energyConsumedC;
final total = data[group.x].energyConsumedKw;
final date = DateFormat('dd/MM/yyyy').format(data[group.x.toInt()].date);
final phaseA = data[group.x.toInt()].energyConsumedA;
final phaseB = data[group.x.toInt()].energyConsumedB;
final phaseC = data[group.x.toInt()].energyConsumedC;
final total = data[group.x.toInt()].energyConsumedKw;
return BarTooltipItem(
'$date\n',

View File

@ -22,8 +22,7 @@ class EnergyConsumptionByPhasesChartBox extends StatelessWidget {
children: [
AnalyticsErrorWidget(state.errorMessage),
EnergyConsumptionByPhasesTitle(
isLoading:
state.status == EnergyConsumptionByPhasesStatus.loading,
isLoading: state.status == EnergyConsumptionByPhasesStatus.loading,
),
const SizedBox(height: 20),
Expanded(

View File

@ -17,6 +17,7 @@ class EnergyConsumptionPerDeviceChart extends StatelessWidget {
context,
leftTitlesInterval: 250,
),
gridData: EnergyManagementChartsHelper.gridData().copyWith(
checkToShowHorizontalLine: (value) => true,
horizontalInterval: 250,

View File

@ -46,8 +46,7 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
flex: 2,
child: EnergyConsumptionPerDeviceDevicesList(
chartData: state.chartData,
devices:
context.watch<AnalyticsDevicesBloc>().state.devices,
devices: context.watch<AnalyticsDevicesBloc>().state.devices,
),
),
],
@ -56,8 +55,7 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
const Divider(height: 0),
const SizedBox(height: 20),
Expanded(
child:
EnergyConsumptionPerDeviceChart(chartData: state.chartData),
child: EnergyConsumptionPerDeviceChart(chartData: state.chartData),
),
],
),

View File

@ -43,14 +43,11 @@ class PowerClampEnergyDataWidget extends StatelessWidget {
title: 'Smart Power Clamp',
showSpaceUuidInDevicesDropdown: true,
onChanged: (device) {
FetchEnergyManagementDataHelper
.loadEnergyConsumptionByPhases(
FetchEnergyManagementDataHelper.loadEnergyConsumptionByPhases(
context,
powerClampUuid: device.uuid,
selectedDate: context
.read<AnalyticsDatePickerBloc>()
.state
.monthlyDate,
selectedDate:
context.read<AnalyticsDatePickerBloc>().state.monthlyDate,
);
},
),
@ -94,8 +91,7 @@ class PowerClampEnergyDataWidget extends StatelessWidget {
),
),
const SizedBox(height: 14),
const Expanded(
flex: 3, child: EnergyConsumptionByPhasesChartBox()),
const Expanded(flex: 3, child: EnergyConsumptionByPhasesChartBox()),
],
),
);

View File

@ -140,9 +140,9 @@ class PowerClampPhasesDataWidget extends StatelessWidget {
String _formatCurrentValue(String? value) {
if (value == null) return '--';
var str = value;
String str = value;
if (str.isEmpty || str == '--') return '--';
str = str.replaceAll(RegExp('[^0-9]'), '');
str = str.replaceAll(RegExp(r'[^0-9]'), '');
if (str.isEmpty) return '--';
if (str.length == 1) return '${str[0]}.0';
return '${str[0]}.${str.substring(1)}';
@ -150,9 +150,9 @@ class PowerClampPhasesDataWidget extends StatelessWidget {
String _formatPowerFactor(String? value) {
if (value == null) return '--';
var str = value;
String str = value;
if (str.isEmpty || str == '--') return '--';
str = str.replaceAll(RegExp('[^0-9]'), '');
str = str.replaceAll(RegExp(r'[^0-9]'), '');
if (str.isEmpty) return '--';
final intValue = int.tryParse(str);
if (intValue == null) return '--';
@ -162,9 +162,9 @@ class PowerClampPhasesDataWidget extends StatelessWidget {
String _formatVoltage(String? value) {
if (value == null) return '--';
var str = value;
String str = value;
if (str.isEmpty || str == '--') return '--';
str = str.replaceAll(RegExp('[^0-9]'), '');
str = str.replaceAll(RegExp(r'[^0-9]'), '');
if (str.isEmpty) return '--';
if (str.length == 1) return '0.${str[0]}';
return '${str.substring(0, str.length - 1)}.${str.substring(str.length - 1)}';

View File

@ -29,6 +29,7 @@ class TotalEnergyConsumptionChart extends StatelessWidget {
),
duration: Duration.zero,
curve: Curves.easeIn,
),
);
}

View File

@ -25,8 +25,7 @@ class TotalEnergyConsumptionChartBox extends StatelessWidget {
Row(
children: [
ChartsLoadingWidget(
isLoading:
state.status == TotalEnergyConsumptionStatus.loading,
isLoading: state.status == TotalEnergyConsumptionStatus.loading,
),
const Expanded(
flex: 3,