mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-26 18:54:55 +00:00
Compare commits
1 Commits
SP-1658-Th
...
SP-1671-en
| Author | SHA1 | Date | |
|---|---|---|---|
| 0135b6711e |
@ -38,7 +38,7 @@ abstract final class EnergyManagementChartsHelper {
|
|||||||
sideTitles: SideTitles(
|
sideTitles: SideTitles(
|
||||||
showTitles: true,
|
showTitles: true,
|
||||||
maxIncluded: false,
|
maxIncluded: false,
|
||||||
minIncluded: true,
|
minIncluded: false,
|
||||||
interval: leftTitlesInterval,
|
interval: leftTitlesInterval,
|
||||||
reservedSize: 110,
|
reservedSize: 110,
|
||||||
getTitlesWidget: (value, meta) => Padding(
|
getTitlesWidget: (value, meta) => Padding(
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import 'package:syncrow_web/pages/analytics/params/get_total_energy_consumption_
|
|||||||
abstract final class FetchEnergyManagementDataHelper {
|
abstract final class FetchEnergyManagementDataHelper {
|
||||||
const FetchEnergyManagementDataHelper._();
|
const FetchEnergyManagementDataHelper._();
|
||||||
|
|
||||||
// static const String _powerClampId = 'cb71d6ad-6e29-4eaa-ae3e-1a0d1c5f60fa';
|
|
||||||
static AnalyticsDevice? getSelectedDevice(BuildContext context) {
|
static AnalyticsDevice? getSelectedDevice(BuildContext context) {
|
||||||
return context.read<AnalyticsDevicesBloc>().state.selectedDevice;
|
return context.read<AnalyticsDevicesBloc>().state.selectedDevice;
|
||||||
}
|
}
|
||||||
@ -48,7 +47,6 @@ abstract final class FetchEnergyManagementDataHelper {
|
|||||||
loadTotalEnergyConsumption(
|
loadTotalEnergyConsumption(
|
||||||
context,
|
context,
|
||||||
selectedDate: selectedDate0,
|
selectedDate: selectedDate0,
|
||||||
communityId: communityId,
|
|
||||||
spaceId: spaceId,
|
spaceId: spaceId,
|
||||||
);
|
);
|
||||||
final selectedDevice = getSelectedDevice(context);
|
final selectedDevice = getSelectedDevice(context);
|
||||||
@ -61,7 +59,6 @@ abstract final class FetchEnergyManagementDataHelper {
|
|||||||
}
|
}
|
||||||
loadEnergyConsumptionPerDevice(
|
loadEnergyConsumptionPerDevice(
|
||||||
context,
|
context,
|
||||||
communityId: communityId,
|
|
||||||
spaceId: spaceId,
|
spaceId: spaceId,
|
||||||
selectedDate: selectedDate0,
|
selectedDate: selectedDate0,
|
||||||
);
|
);
|
||||||
@ -84,12 +81,10 @@ abstract final class FetchEnergyManagementDataHelper {
|
|||||||
static void loadTotalEnergyConsumption(
|
static void loadTotalEnergyConsumption(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
DateTime? selectedDate,
|
DateTime? selectedDate,
|
||||||
required String communityId,
|
|
||||||
required String spaceId,
|
required String spaceId,
|
||||||
}) {
|
}) {
|
||||||
final param = GetTotalEnergyConsumptionParam(
|
final param = GetTotalEnergyConsumptionParam(
|
||||||
spaceId: spaceId,
|
spaceId: spaceId,
|
||||||
communityId: communityId,
|
|
||||||
monthDate: selectedDate,
|
monthDate: selectedDate,
|
||||||
);
|
);
|
||||||
context.read<TotalEnergyConsumptionBloc>().add(
|
context.read<TotalEnergyConsumptionBloc>().add(
|
||||||
@ -100,12 +95,10 @@ abstract final class FetchEnergyManagementDataHelper {
|
|||||||
static void loadEnergyConsumptionPerDevice(
|
static void loadEnergyConsumptionPerDevice(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
DateTime? selectedDate,
|
DateTime? selectedDate,
|
||||||
required String communityId,
|
|
||||||
required String spaceId,
|
required String spaceId,
|
||||||
}) {
|
}) {
|
||||||
final param = GetEnergyConsumptionPerDeviceParam(
|
final param = GetEnergyConsumptionPerDeviceParam(
|
||||||
spaceId: spaceId,
|
spaceId: spaceId,
|
||||||
communityId: communityId,
|
|
||||||
monthDate: selectedDate,
|
monthDate: selectedDate,
|
||||||
);
|
);
|
||||||
context.read<EnergyConsumptionPerDeviceBloc>().add(
|
context.read<EnergyConsumptionPerDeviceBloc>().add(
|
||||||
|
|||||||
@ -23,6 +23,7 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(30),
|
padding: const EdgeInsets.all(30),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
spacing: 20,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
AnalyticsErrorWidget(state.errorMessage),
|
AnalyticsErrorWidget(state.errorMessage),
|
||||||
@ -51,9 +52,7 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
const Divider(height: 0),
|
const Divider(height: 0),
|
||||||
const SizedBox(height: 20),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: EnergyConsumptionPerDeviceChart(chartData: state.chartData),
|
child: EnergyConsumptionPerDeviceChart(chartData: state.chartData),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -19,6 +19,7 @@ class TotalEnergyConsumptionChartBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(30),
|
padding: const EdgeInsets.all(30),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
spacing: 20,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
AnalyticsErrorWidget(state.errorMessage),
|
AnalyticsErrorWidget(state.errorMessage),
|
||||||
@ -38,9 +39,7 @@ class TotalEnergyConsumptionChartBox extends StatelessWidget {
|
|||||||
const Spacer(flex: 4),
|
const Spacer(flex: 4),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 20),
|
|
||||||
TotalEnergyConsumptionChart(chartData: state.chartData),
|
TotalEnergyConsumptionChart(chartData: state.chartData),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class OccupancyChartBox extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(30),
|
padding: const EdgeInsets.all(30),
|
||||||
decoration: containerWhiteDecoration,
|
decoration: containerWhiteDecoration,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
spacing: 20,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -64,9 +65,7 @@ class OccupancyChartBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const Divider(height: 0),
|
||||||
const Divider(),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Expanded(child: OccupancyChart(chartData: state.chartData)),
|
Expanded(child: OccupancyChart(chartData: state.chartData)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class OccupancyHeatMapBox extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(30),
|
padding: const EdgeInsets.all(30),
|
||||||
decoration: containerWhiteDecoration,
|
decoration: containerWhiteDecoration,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
spacing: 20,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@ -65,9 +66,7 @@ class OccupancyHeatMapBox extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const Divider(height: 0),
|
||||||
const Divider(),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: OccupancyHeatMap(
|
child: OccupancyHeatMap(
|
||||||
heatMapData: state.heatMapData.asMap().map(
|
heatMapData: state.heatMapData.asMap().map(
|
||||||
|
|||||||
@ -2,18 +2,15 @@ class GetEnergyConsumptionPerDeviceParam {
|
|||||||
const GetEnergyConsumptionPerDeviceParam({
|
const GetEnergyConsumptionPerDeviceParam({
|
||||||
this.monthDate,
|
this.monthDate,
|
||||||
this.spaceId,
|
this.spaceId,
|
||||||
this.communityId,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final DateTime? monthDate;
|
final DateTime? monthDate;
|
||||||
final String? spaceId;
|
final String? spaceId;
|
||||||
final String? communityId;
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'monthDate':
|
'monthDate':
|
||||||
'${monthDate?.year}-${monthDate?.month.toString().padLeft(2, '0')}',
|
'${monthDate?.year}-${monthDate?.month.toString().padLeft(2, '0')}',
|
||||||
if (spaceId == null || spaceId == null) 'spaceUuid': spaceId,
|
if (spaceId == null || spaceId == null) 'spaceUuid': spaceId,
|
||||||
'communityUuid': communityId,
|
|
||||||
'groupByDevice': true,
|
'groupByDevice': true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
class GetTotalEnergyConsumptionParam {
|
class GetTotalEnergyConsumptionParam {
|
||||||
final DateTime? monthDate;
|
final DateTime? monthDate;
|
||||||
final String? spaceId;
|
final String? spaceId;
|
||||||
final String? communityId;
|
|
||||||
|
|
||||||
const GetTotalEnergyConsumptionParam({
|
const GetTotalEnergyConsumptionParam({
|
||||||
this.monthDate,
|
this.monthDate,
|
||||||
this.spaceId,
|
this.spaceId,
|
||||||
this.communityId,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -14,7 +12,6 @@ class GetTotalEnergyConsumptionParam {
|
|||||||
'monthDate':
|
'monthDate':
|
||||||
'${monthDate?.year}-${monthDate?.month.toString().padLeft(2, '0')}',
|
'${monthDate?.year}-${monthDate?.month.toString().padLeft(2, '0')}',
|
||||||
if (spaceId == null || spaceId == null) 'spaceUuid': spaceId,
|
if (spaceId == null || spaceId == null) 'spaceUuid': spaceId,
|
||||||
'communityUuid': communityId,
|
|
||||||
'groupByDevice': false,
|
'groupByDevice': false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,17 +11,14 @@ class AnalyticsErrorWidget extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: errorMessage != null || (errorMessage?.isNotEmpty ?? false),
|
visible: errorMessage != null || (errorMessage?.isNotEmpty ?? false),
|
||||||
child: Padding(
|
child: Text(
|
||||||
padding: const EdgeInsetsDirectional.only(bottom: 10),
|
errorMessage ?? 'Something went wrong',
|
||||||
child: Text(
|
maxLines: 1,
|
||||||
errorMessage ?? 'Something went wrong',
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
style: context.textTheme.bodySmall?.copyWith(
|
||||||
overflow: TextOverflow.ellipsis,
|
color: ColorsManager.red,
|
||||||
style: context.textTheme.bodySmall?.copyWith(
|
fontWeight: FontWeight.w400,
|
||||||
color: ColorsManager.red,
|
fontSize: 8,
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontSize: 8,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user