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

@ -52,7 +52,8 @@ 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,7 +18,6 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget {
Widget build(BuildContext context) {
return BarChart(
BarChartData(
gridData: EnergyManagementChartsHelper.gridData().copyWith(
checkToShowHorizontalLine: (value) => true,
horizontalInterval: 250,
@ -100,11 +99,11 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget {
}) {
final data = energyData;
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;
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;
return BarTooltipItem(
'$date\n',

View File

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

View File

@ -46,7 +46,8 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
flex: 2,
child: EnergyConsumptionPerDeviceDevicesList(
chartData: state.chartData,
devices: context.watch<AnalyticsDevicesBloc>().state.devices,
devices:
context.watch<AnalyticsDevicesBloc>().state.devices,
),
),
],
@ -55,7 +56,8 @@ 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,11 +43,14 @@ 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,
);
},
),
@ -91,7 +94,8 @@ 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 '--';
String str = value;
var str = value;
if (str.isEmpty || str == '--') return '--';
str = str.replaceAll(RegExp(r'[^0-9]'), '');
str = str.replaceAll(RegExp('[^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 '--';
String str = value;
var str = value;
if (str.isEmpty || str == '--') return '--';
str = str.replaceAll(RegExp(r'[^0-9]'), '');
str = str.replaceAll(RegExp('[^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 '--';
String str = value;
var str = value;
if (str.isEmpty || str == '--') return '--';
str = str.replaceAll(RegExp(r'[^0-9]'), '');
str = str.replaceAll(RegExp('[^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,7 +29,6 @@ class TotalEnergyConsumptionChart extends StatelessWidget {
),
duration: Duration.zero,
curve: Curves.easeIn,
),
);
}

View File

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