From f67d0e29127f171209caeec2fde21798c417a7ad Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Mon, 19 May 2025 10:17:48 +0300 Subject: [PATCH 01/11] SP-1494 reworks. 1. When the chart loads, we see it coming from the top right corner (check the attached video). 2. Day 1 is missing on the X axis. 3. Overlapping line not removed. --- .../energy_management_charts_helper.dart | 45 +++++++++++-------- .../energy_consumption_per_device_chart.dart | 3 +- .../total_energy_consumption_chart.dart | 4 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart index b8849335..8e7a9f58 100644 --- a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart +++ b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart @@ -20,12 +20,12 @@ abstract final class EnergyManagementChartsHelper { interval: 1, reservedSize: 32, showTitles: true, - maxIncluded: false, - minIncluded: false, + maxIncluded: true, + minIncluded: true, getTitlesWidget: (value, meta) => Padding( padding: const EdgeInsetsDirectional.only(top: 20.0), child: Text( - (value + 1).toString(), + value.toString(), style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.greyColor, fontSize: 12, @@ -72,7 +72,7 @@ abstract final class EnergyManagementChartsHelper { static List getTooltipItems(List touchedSpots) { return touchedSpots.map((spot) { return LineTooltipItem( - getToolTipLabel(spot.x + 1, spot.y), + getToolTipLabel(spot.x, spot.y), const TextStyle( color: ColorsManager.textPrimaryColor, fontWeight: FontWeight.w600, @@ -93,31 +93,38 @@ abstract final class EnergyManagementChartsHelper { ); } - static FlBorderData borderData() { - return FlBorderData( - show: true, - border: const Border.symmetric( - horizontal: BorderSide( - color: ColorsManager.greyColor, - style: BorderStyle.solid, - width: 1, - ), - ), - ); - } - static FlGridData gridData() { - return const FlGridData( + return FlGridData( show: true, drawVerticalLine: false, drawHorizontalLine: true, + horizontalInterval: 250, + getDrawingHorizontalLine: (value) { + return FlLine( + color: ColorsManager.greyColor, + strokeWidth: 1, + dashArray: value == 0 ? null : [5, 5], + ); + }, + ); + } + + static FlBorderData borderData() { + return FlBorderData( + border: const Border( + bottom: BorderSide( + color: ColorsManager.greyColor, + style: BorderStyle.solid, + ), + ), + show: true, ); } static LineTouchData lineTouchData() { return LineTouchData( handleBuiltInTouches: true, - touchSpotThreshold: 2, + touchSpotThreshold: 16, touchTooltipData: EnergyManagementChartsHelper.lineTouchTooltipData(), ); } diff --git a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart.dart b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart.dart index 892e4676..fcf7d384 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart.dart @@ -16,6 +16,7 @@ class EnergyConsumptionPerDeviceChart extends StatelessWidget { context, leftTitlesInterval: 250, ), + gridData: EnergyManagementChartsHelper.gridData().copyWith( checkToShowHorizontalLine: (value) => true, horizontalInterval: 250, @@ -36,7 +37,7 @@ class EnergyConsumptionPerDeviceChart extends StatelessWidget { ); }).toList(), ), - duration: Durations.extralong1, + duration: Duration.zero, curve: Curves.easeIn, ); } diff --git a/lib/pages/analytics/modules/energy_management/widgets/total_energy_consumption_chart.dart b/lib/pages/analytics/modules/energy_management/widgets/total_energy_consumption_chart.dart index b0f7961a..204261df 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/total_energy_consumption_chart.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/total_energy_consumption_chart.dart @@ -26,7 +26,7 @@ class TotalEnergyConsumptionChart extends StatelessWidget { lineTouchData: EnergyManagementChartsHelper.lineTouchData(), lineBarsData: _lineBarsData, ), - duration: Durations.extralong1, + duration: Duration.zero, curve: Curves.easeIn, ), ); @@ -43,7 +43,7 @@ class TotalEnergyConsumptionChart extends StatelessWidget { .entries .map( (entry) => FlSpot( - entry.key.toDouble(), + entry.value.date.day.toDouble(), entry.value.value, ), ) From 494ae1c941d23ad420c8ac248f98e9f8aa8a5d40 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Mon, 19 May 2025 10:52:44 +0300 Subject: [PATCH 02/11] SP-1495 reworks. 1. Overlapping line not removed. 2. The colors of the data on X axis and Y axis are not identical to design. 3. Day 1 and 2 are missing on the X axis. 4. When the chart loads, we see it coming from the top right corner (check the attached video). 5. Display all available devices even if they have no data and make the chart empty state. --- .../analytics/models/analytics_device.dart | 54 ++++++++++- .../energy_management_charts_helper.dart | 2 +- ...ergy_consumption_per_device_chart_box.dart | 2 + ...y_consumption_per_device_devices_list.dart | 89 ++++++++++++------- ...energy_consumption_per_device_service.dart | 5 +- 5 files changed, 112 insertions(+), 40 deletions(-) diff --git a/lib/pages/analytics/models/analytics_device.dart b/lib/pages/analytics/models/analytics_device.dart index 6f066407..d2301e4a 100644 --- a/lib/pages/analytics/models/analytics_device.dart +++ b/lib/pages/analytics/models/analytics_device.dart @@ -1,13 +1,65 @@ class AnalyticsDevice { - const AnalyticsDevice({required this.name, required this.uuid}); + const AnalyticsDevice({ + required this.uuid, + required this.name, + required this.createdAt, + required this.updatedAt, + required this.deviceTuyaUuid, + required this.isActive, + required this.productDevice, + }); final String uuid; final String name; + final DateTime createdAt; + final DateTime updatedAt; + final String deviceTuyaUuid; + final bool isActive; + final ProductDevice productDevice; factory AnalyticsDevice.fromJson(Map json) { return AnalyticsDevice( uuid: json['uuid'] as String? ?? '', name: json['name'] as String? ?? '', + createdAt: DateTime.parse(json['createdAt'] as String? ?? ''), + updatedAt: DateTime.parse(json['updatedAt'] as String? ?? ''), + deviceTuyaUuid: json['deviceTuyaUuid'] as String? ?? '', + isActive: json['isActive'] as bool? ?? false, + productDevice: ProductDevice.fromJson( + json['productDevice'] as Map? ?? {}, + ), + ); + } +} + +class ProductDevice { + const ProductDevice({ + required this.uuid, + required this.createdAt, + required this.updatedAt, + required this.catName, + required this.prodId, + required this.name, + required this.prodType, + }); + + final String uuid; + final DateTime createdAt; + final DateTime updatedAt; + final String catName; + final String prodId; + final String name; + final String prodType; + + factory ProductDevice.fromJson(Map json) { + return ProductDevice( + uuid: json['uuid'] as String? ?? '', + createdAt: DateTime.parse(json['createdAt'] as String? ?? ''), + updatedAt: DateTime.parse(json['updatedAt'] as String? ?? ''), + catName: json['catName'] as String? ?? '', + prodId: json['prodId'] as String? ?? '', + name: json['name'] as String? ?? '', + prodType: json['prodType'] as String? ?? '', ); } } diff --git a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart index 8e7a9f58..dadfc70f 100644 --- a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart +++ b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart @@ -38,7 +38,7 @@ abstract final class EnergyManagementChartsHelper { sideTitles: SideTitles( showTitles: true, maxIncluded: false, - minIncluded: false, + minIncluded: true, interval: leftTitlesInterval, reservedSize: 110, getTitlesWidget: (value, meta) => Padding( diff --git a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart_box.dart b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart_box.dart index b62ebe54..f22517d5 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart_box.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart_box.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_web/pages/analytics/modules/analytics/blocs/analytics_devices/analytics_devices_bloc.dart'; import 'package:syncrow_web/pages/analytics/modules/energy_management/blocs/energy_consumption_per_device/energy_consumption_per_device_bloc.dart'; import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/chart_title.dart'; import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart.dart'; @@ -46,6 +47,7 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget { flex: 2, child: EnergyConsumptionPerDeviceDevicesList( chartData: state.chartData, + devices: context.watch().state.devices, ), ), ], diff --git a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart index da7a59a8..5ef434e1 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart @@ -1,10 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:syncrow_web/pages/analytics/models/analytics_device.dart'; import 'package:syncrow_web/pages/analytics/models/device_energy_data_model.dart'; import 'package:syncrow_web/utils/color_manager.dart'; class EnergyConsumptionPerDeviceDevicesList extends StatelessWidget { - const EnergyConsumptionPerDeviceDevicesList({required this.chartData, super.key}); + const EnergyConsumptionPerDeviceDevicesList({ + required this.chartData, + required this.devices, + super.key, + }); + final List devices; final List chartData; @override @@ -16,45 +22,60 @@ class EnergyConsumptionPerDeviceDevicesList extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, - children: chartData.map((e) => _buildDeviceCell(context, e)).toList(), + children: devices.map((e) => _buildDeviceCell(context, e)).toList(), ), ); } - Widget _buildDeviceCell(BuildContext context, DeviceEnergyDataModel device) { - return Container( - height: MediaQuery.sizeOf(context).height * 0.0365, - padding: const EdgeInsetsDirectional.symmetric( - vertical: 8, - horizontal: 12, - ), - decoration: BoxDecoration( - borderRadius: BorderRadiusDirectional.circular(8), - border: Border.all( - color: ColorsManager.greyColor, - width: 1, + Widget _buildDeviceCell(BuildContext context, AnalyticsDevice device) { + final deviceColor = chartData + .firstWhere( + (element) => element.deviceId == device.uuid, + orElse: () => const DeviceEnergyDataModel( + energy: [], + deviceName: '', + deviceId: '', + color: Colors.red, + ), + ) + .color; + + return Tooltip( + message: '${device.name}\n${device.productDevice.uuid}', + child: Container( + height: MediaQuery.sizeOf(context).height * 0.0365, + padding: const EdgeInsetsDirectional.symmetric( + vertical: 8, + horizontal: 12, ), - ), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.center, - child: Row( - spacing: 6, - children: [ - CircleAvatar( - radius: 4, - backgroundColor: device.color, - ), - Text( - device.deviceName, - textAlign: TextAlign.center, - style: const TextStyle( - color: ColorsManager.blackColor, - fontWeight: FontWeight.w400, - fontSize: 14, + decoration: BoxDecoration( + borderRadius: BorderRadiusDirectional.circular(8), + border: Border.all( + color: ColorsManager.greyColor, + width: 1, + ), + ), + child: FittedBox( + fit: BoxFit.scaleDown, + alignment: Alignment.center, + child: Row( + spacing: 6, + children: [ + CircleAvatar( + radius: 4, + backgroundColor: deviceColor, ), - ), - ], + Text( + device.name, + textAlign: TextAlign.center, + style: const TextStyle( + color: ColorsManager.blackColor, + fontWeight: FontWeight.w400, + fontSize: 14, + ), + ), + ], + ), ), ), ); diff --git a/lib/pages/analytics/services/energy_consumption_per_device/remote_energy_consumption_per_device_service.dart b/lib/pages/analytics/services/energy_consumption_per_device/remote_energy_consumption_per_device_service.dart index 8ceb6d80..165ab5ab 100644 --- a/lib/pages/analytics/services/energy_consumption_per_device/remote_energy_consumption_per_device_service.dart +++ b/lib/pages/analytics/services/energy_consumption_per_device/remote_energy_consumption_per_device_service.dart @@ -34,10 +34,7 @@ abstract final class _EnergyConsumptionPerDeviceMapper { static List map(dynamic data) { final json = data as Map? ?? {}; final mappedData = json['data'] as List? ?? []; - return mappedData.where((e) { - final deviceData = (e as Map)['data'] as List? ?? []; - return deviceData.isNotEmpty; - }).map((e) { + return mappedData.map((e) { final deviceData = e as Map; final energyData = deviceData['data'] as List; From 625f7377912bcaf5b2a3645c937894c8321000f5 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Mon, 19 May 2025 11:05:08 +0300 Subject: [PATCH 03/11] SP-1506 rework Remove extra line. The colors of the data on X axis and Y axis are not identical to design. Display days only on the X axis. When the bar chart loads, we see it coming from the top (check the attached video). --- .../analytics_page_tabs_and_children.dart | 1 + .../fetch_energy_management_data_helper.dart | 19 +++++++++++-------- .../energy_consumption_by_phases_chart.dart | 9 +++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/pages/analytics/modules/analytics/widgets/analytics_page_tabs_and_children.dart b/lib/pages/analytics/modules/analytics/widgets/analytics_page_tabs_and_children.dart index 77871134..5e9e347a 100644 --- a/lib/pages/analytics/modules/analytics/widgets/analytics_page_tabs_and_children.dart +++ b/lib/pages/analytics/modules/analytics/widgets/analytics_page_tabs_and_children.dart @@ -74,6 +74,7 @@ class AnalyticsPageTabsAndChildren extends StatelessWidget { FetchEnergyManagementDataHelper .loadEnergyManagementData( context, + shouldFetchAnalyticsDevices: false, selectedDate: value, communityId: spaceTreeState.selectedCommunities.firstOrNull ?? diff --git a/lib/pages/analytics/modules/energy_management/helpers/fetch_energy_management_data_helper.dart b/lib/pages/analytics/modules/energy_management/helpers/fetch_energy_management_data_helper.dart index 29da8c61..a6fe4703 100644 --- a/lib/pages/analytics/modules/energy_management/helpers/fetch_energy_management_data_helper.dart +++ b/lib/pages/analytics/modules/energy_management/helpers/fetch_energy_management_data_helper.dart @@ -26,6 +26,7 @@ abstract final class FetchEnergyManagementDataHelper { required String communityId, required String spaceId, DateTime? selectedDate, + bool shouldFetchAnalyticsDevices = true, }) { if (communityId.isEmpty && spaceId.isEmpty) { clearAllData(context); @@ -34,12 +35,16 @@ abstract final class FetchEnergyManagementDataHelper { final datePickerState = context.read().state; final selectedDate0 = selectedDate ?? datePickerState.monthlyDate; - loadAnalyticsDevices( - context, - communityUuid: communityId, - spaceUuid: spaceId, - selectedDate: selectedDate0, - ); + if (shouldFetchAnalyticsDevices) { + loadAnalyticsDevices( + context, + communityUuid: communityId, + spaceUuid: spaceId, + selectedDate: selectedDate0, + ); + loadRealtimeDeviceChanges(context); + loadPowerClampInfo(context); + } loadTotalEnergyConsumption( context, selectedDate: selectedDate0, @@ -60,8 +65,6 @@ abstract final class FetchEnergyManagementDataHelper { spaceId: spaceId, selectedDate: selectedDate0, ); - loadRealtimeDeviceChanges(context); - loadPowerClampInfo(context); } static void loadEnergyConsumptionByPhases( diff --git a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart index 805ed551..1497d0fd 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart @@ -56,7 +56,7 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget { ColorsManager.vividBlue.withValues(alpha: 0.15), ), ], - width: 16, + width: 8, borderRadius: const BorderRadius.only( topLeft: Radius.circular(8), topRight: Radius.circular(8), @@ -66,6 +66,7 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget { ); }).toList(), ), + duration: Duration.zero, ); } @@ -160,9 +161,9 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget { sideTitles: SideTitles( showTitles: true, getTitlesWidget: (value, _) { - final month = DateFormat('dd/MM').format(energyData[value.toInt()].date); + final month = DateFormat('d').format(energyData[value.toInt()].date); return FittedBox( - alignment: AlignmentDirectional.bottomCenter, + alignment: AlignmentDirectional.center, fit: BoxFit.scaleDown, child: RotatedBox( quarterTurns: 3, @@ -176,7 +177,7 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget { ), ); }, - reservedSize: 36, + reservedSize: 18, ), ); From 4326559e14c2b74f467f5f4f90f1a49c44d6864d Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Tue, 20 May 2025 13:51:04 +0300 Subject: [PATCH 04/11] shows `OccupancyHeatMapBox` instead of a `Placeholder` in vertical srcollable `AnalyticsOccupancyView`. --- .../modules/occupancy/views/analytics_occupancy_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart b/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart index df4ba4a8..2cf18742 100644 --- a/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart +++ b/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart @@ -22,7 +22,7 @@ class AnalyticsOccupancyView extends StatelessWidget { children: [ SizedBox(height: height * 0.45, child: const OccupancyEndSideBar()), SizedBox(height: height * 0.5, child: const OccupancyChartBox()), - SizedBox(height: height * 0.5, child: const Placeholder()), + SizedBox(height: height * 0.5, child: const OccupancyHeatMapBox()), ], ), ); From c21842cc6dcabce67eb6a7298a4e456081e718da Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Tue, 20 May 2025 13:56:00 +0300 Subject: [PATCH 05/11] removed overflow and fixed sizing and text drawing of `PowerClampEnergyStatusWidget`. --- .../widgets/power_clamp_energy_status_widget.dart | 3 +++ .../modules/occupancy/views/analytics_occupancy_view.dart | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pages/analytics/modules/energy_management/widgets/power_clamp_energy_status_widget.dart b/lib/pages/analytics/modules/energy_management/widgets/power_clamp_energy_status_widget.dart index 27d74ae0..fc957035 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/power_clamp_energy_status_widget.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/power_clamp_energy_status_widget.dart @@ -48,6 +48,9 @@ class PowerClampEnergyStatusWidget extends StatelessWidget { fontWeight: FontWeight.w400, fontSize: 16, ), + softWrap: true, + maxLines: 2, + overflow: TextOverflow.ellipsis, ), trailing: Text.rich( TextSpan( diff --git a/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart b/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart index 2cf18742..679c9927 100644 --- a/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart +++ b/lib/pages/analytics/modules/occupancy/views/analytics_occupancy_view.dart @@ -20,7 +20,7 @@ class AnalyticsOccupancyView extends StatelessWidget { child: Column( spacing: 32, children: [ - SizedBox(height: height * 0.45, child: const OccupancyEndSideBar()), + SizedBox(height: height * 0.46, child: const OccupancyEndSideBar()), SizedBox(height: height * 0.5, child: const OccupancyChartBox()), SizedBox(height: height * 0.5, child: const OccupancyHeatMapBox()), ], From 15343be258f4f31896a841f19a3efa83d07760cb Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Tue, 20 May 2025 14:11:25 +0300 Subject: [PATCH 06/11] show space uuid in analytics devices dropdown. --- .../widgets/analytics_device_dropdown.dart | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart index 0d96fb70..044cf1fb 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/analytics/models/analytics_device.dart'; import 'package:syncrow_web/pages/analytics/modules/analytics/blocs/analytics_devices/analytics_devices_bloc.dart'; +import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart'; @@ -48,6 +49,7 @@ class AnalyticsDeviceDropdown extends StatelessWidget { } Widget _buildDevicesDropdown(BuildContext context, AnalyticsDevicesState state) { + final spaceUuid = context.read().state.selectedSpaces.firstOrNull; return DropdownButton( value: state.selectedDevice, isDense: true, @@ -60,10 +62,32 @@ class AnalyticsDeviceDropdown extends StatelessWidget { ), style: _getTextStyle(context), padding: _defaultPadding, + selectedItemBuilder: (context) { + return state.devices.map((e) { + return Text(e.name); + }).toList(); + }, items: state.devices.map((e) { return DropdownMenuItem( value: e, - child: Text(e.name), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text(e.name), + if (spaceUuid != null) + FittedBox( + fit: BoxFit.scaleDown, + alignment: AlignmentDirectional.centerStart, + child: Text( + spaceUuid, + style: _getTextStyle(context)?.copyWith( + fontSize: 10, + ), + ), + ), + ], + ), ); }).toList(), onChanged: (value) { From 4c2802acfc53b2f70f71b6e995db7ed046b9d093 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Tue, 20 May 2025 14:20:16 +0300 Subject: [PATCH 07/11] date picker decorations matched with design. --- .../widgets/month_picker_widget.dart | 47 ++++++++++++------- .../analytics/widgets/year_picker_widget.dart | 41 ++++++++++------ 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart b/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart index ab7603e5..57133b02 100644 --- a/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart +++ b/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart @@ -178,7 +178,6 @@ class _MonthPickerWidgetState extends State { shrinkWrap: true, itemCount: 12, physics: const NeverScrollableScrollPhysics(), - padding: const EdgeInsets.all(8), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, childAspectRatio: 2.5, @@ -191,27 +190,39 @@ class _MonthPickerWidgetState extends State { return InkWell( onTap: isFutureMonth ? null : () => setState(() => _selectedMonth = index), - child: Container( - alignment: Alignment.center, + child: DecoratedBox( decoration: BoxDecoration( - color: isSelected - ? ColorsManager.vividBlue.withValues(alpha: 0.7) - : isFutureMonth - ? ColorsManager.grey700.withValues(alpha: 0.1) - : const Color(0xFFEDF2F7), - borderRadius: - isSelected ? BorderRadius.circular(15) : BorderRadius.zero, + color: const Color(0xFFEDF2F7), + borderRadius: BorderRadius.only( + topLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero, + bottomLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero, + topRight: index % 3 == 2 ? const Radius.circular(16) : Radius.zero, + bottomRight: + index % 3 == 2 ? const Radius.circular(16) : Radius.zero, + ), ), - child: Text( - _monthNames[index], - style: context.textTheme.titleSmall?.copyWith( - fontSize: 12, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( color: isSelected - ? ColorsManager.whiteColors + ? ColorsManager.vividBlue.withValues(alpha: 0.7) : isFutureMonth - ? ColorsManager.blackColor.withValues(alpha: 0.3) - : ColorsManager.blackColor.withValues(alpha: 0.8), - fontWeight: FontWeight.w500, + ? ColorsManager.grey700.withValues(alpha: 0.1) + : const Color(0xFFEDF2F7), + borderRadius: + isSelected ? BorderRadius.circular(15) : BorderRadius.zero, + ), + child: Text( + _monthNames[index], + style: context.textTheme.titleSmall?.copyWith( + fontSize: 12, + color: isSelected + ? ColorsManager.whiteColors + : isFutureMonth + ? ColorsManager.blackColor.withValues(alpha: 0.3) + : ColorsManager.blackColor.withValues(alpha: 0.8), + fontWeight: FontWeight.w500, + ), ), ), ), diff --git a/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart b/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart index 2bcb223b..22eb6646 100644 --- a/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart +++ b/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart @@ -109,7 +109,6 @@ class _YearPickerWidgetState extends State { shrinkWrap: true, itemCount: years.length, physics: const NeverScrollableScrollPhysics(), - padding: const EdgeInsets.all(8), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, childAspectRatio: 2.5, @@ -120,23 +119,35 @@ class _YearPickerWidgetState extends State { final isSelected = _currentYear == years[index]; return InkWell( onTap: () => setState(() => _currentYear = years[index]), - child: Container( - alignment: Alignment.center, + child: DecoratedBox( decoration: BoxDecoration( - color: isSelected - ? ColorsManager.vividBlue.withValues(alpha: 0.7) - : const Color(0xFFEDF2F7), - borderRadius: - isSelected ? BorderRadius.circular(15) : BorderRadius.zero, + color: const Color(0xFFEDF2F7), + borderRadius: BorderRadius.only( + topLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero, + bottomLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero, + topRight: index % 3 == 2 ? const Radius.circular(16) : Radius.zero, + bottomRight: + index % 3 == 2 ? const Radius.circular(16) : Radius.zero, + ), ), - child: Text( - years[index].toString(), - style: context.textTheme.titleSmall?.copyWith( - fontSize: 12, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( color: isSelected - ? ColorsManager.whiteColors - : ColorsManager.blackColor.withValues(alpha: 0.8), - fontWeight: FontWeight.w500, + ? ColorsManager.vividBlue.withValues(alpha: 0.7) + : const Color(0xFFEDF2F7), + borderRadius: + isSelected ? BorderRadius.circular(15) : BorderRadius.zero, + ), + child: Text( + years[index].toString(), + style: context.textTheme.titleSmall?.copyWith( + fontSize: 12, + color: isSelected + ? ColorsManager.whiteColors + : ColorsManager.blackColor.withValues(alpha: 0.8), + fontWeight: FontWeight.w500, + ), ), ), ), From fd2a09cada222b339c1ab12742ae8bdf446f2ad2 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Tue, 20 May 2025 14:22:23 +0300 Subject: [PATCH 08/11] Deleted unused `FakeEnergyConsumptionPerDeviceService`. --- ...energy_consumption_per_device_service.dart | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 lib/pages/analytics/services/energy_consumption_per_device/fake_energy_consumption_per_device_service.dart diff --git a/lib/pages/analytics/services/energy_consumption_per_device/fake_energy_consumption_per_device_service.dart b/lib/pages/analytics/services/energy_consumption_per_device/fake_energy_consumption_per_device_service.dart deleted file mode 100644 index b1608eea..00000000 --- a/lib/pages/analytics/services/energy_consumption_per_device/fake_energy_consumption_per_device_service.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'dart:math' as math show Random; - -import 'package:flutter/material.dart'; -import 'package:syncrow_web/pages/analytics/models/device_energy_data_model.dart'; -import 'package:syncrow_web/pages/analytics/models/energy_data_model.dart'; -import 'package:syncrow_web/pages/analytics/params/get_energy_consumption_per_device_param.dart'; -import 'package:syncrow_web/pages/analytics/services/energy_consumption_per_device/energy_consumption_per_device_service.dart'; - -class FakeEnergyConsumptionPerDeviceService - implements EnergyConsumptionPerDeviceService { - @override - Future> load( - GetEnergyConsumptionPerDeviceParam param, - ) { - final random = math.Random(); - return Future.delayed(const Duration(milliseconds: 500), () { - return [ - (Colors.redAccent, 1), - (Colors.lightBlueAccent, 2), - (Colors.purpleAccent, 3), - ].map((e) { - final (color, index) = e; - return DeviceEnergyDataModel( - color: color, - energy: List.generate(30, (i) => i) - .map( - (index) => EnergyDataModel( - date: DateTime(2025, 1, index + 1), - value: random.nextInt(100) + (index * 100), - ), - ) - .toList(), - deviceName: 'Device $index', - deviceId: 'device_$index', - ); - }).toList(); - }); - } -} From b2bf3866a9962d79486705303e8526f5f25870ce Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Wed, 21 May 2025 09:09:32 +0300 Subject: [PATCH 09/11] Deleted `pubspec.lock`, and added it to `.gitignore`. --- .gitignore | 1 + pubspec.lock | 906 --------------------------------------------------- 2 files changed, 1 insertion(+), 906 deletions(-) delete mode 100644 pubspec.lock diff --git a/.gitignore b/.gitignore index 29a3a501..fa9d8443 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ +pubspec.lock # Symbolication related app.*.symbols diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index fb0d6a22..00000000 --- a/pubspec.lock +++ /dev/null @@ -1,906 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _flutterfire_internals: - dependency: transitive - description: - name: _flutterfire_internals - sha256: e051259913915ea5bc8fe18664596bea08592fd123930605d562969cd7315fcd - url: "https://pub.dev" - source: hosted - version: "1.3.51" - args: - dependency: transitive - description: - name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.dev" - source: hosted - version: "2.5.0" - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - bloc: - dependency: "direct main" - description: - name: bloc - sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" - url: "https://pub.dev" - source: hosted - version: "8.1.4" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - characters: - dependency: transitive - description: - name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf - url: "https://pub.dev" - source: hosted - version: "1.19.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" - url: "https://pub.dev" - source: hosted - version: "3.0.6" - csslib: - dependency: transitive - description: - name: csslib - sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" - url: "https://pub.dev" - source: hosted - version: "0.17.3" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" - data_table_2: - dependency: "direct main" - description: - name: data_table_2 - sha256: f02ec9b24f44420816a87370ff4f4e533e15b274f6267e4c9a88a585ad1a0473 - url: "https://pub.dev" - source: hosted - version: "2.5.15" - dio: - dependency: "direct main" - description: - name: dio - sha256: e17f6b3097b8c51b72c74c9f071a605c47bcc8893839bd66732457a5ebe73714 - url: "https://pub.dev" - source: hosted - version: "5.5.0+1" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - dropdown_button2: - dependency: "direct main" - description: - name: dropdown_button2 - sha256: b0fe8d49a030315e9eef6c7ac84ca964250155a6224d491c1365061bc974a9e1 - url: "https://pub.dev" - source: hosted - version: "2.3.9" - dropdown_search: - dependency: "direct main" - description: - name: dropdown_search - sha256: "55106e8290acaa97ed15bea1fdad82c3cf0c248dd410e651f5a8ac6870f783ab" - url: "https://pub.dev" - source: hosted - version: "5.0.6" - equatable: - dependency: "direct main" - description: - name: equatable - sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 - url: "https://pub.dev" - source: hosted - version: "2.0.5" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - ffi: - dependency: transitive - description: - name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - file: - dependency: transitive - description: - name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - firebase_analytics: - dependency: "direct main" - description: - name: firebase_analytics - sha256: "47428047a0778f72af53a3c7cb5d556e1cb25e2327cc8aa40d544971dc6245b2" - url: "https://pub.dev" - source: hosted - version: "11.4.2" - firebase_analytics_platform_interface: - dependency: transitive - description: - name: firebase_analytics_platform_interface - sha256: "1076f4b041f76143e14878c70f0758f17fe5910c0cd992db9e93bd3c3584512b" - url: "https://pub.dev" - source: hosted - version: "4.3.2" - firebase_analytics_web: - dependency: transitive - description: - name: firebase_analytics_web - sha256: "8f6dd64ea6d28b7f5b9e739d183a9e1c7f17027794a3e9aba1879621d42426ef" - url: "https://pub.dev" - source: hosted - version: "0.5.10+8" - firebase_core: - dependency: "direct main" - description: - name: firebase_core - sha256: "93dc4dd12f9b02c5767f235307f609e61ed9211047132d07f9e02c668f0bfc33" - url: "https://pub.dev" - source: hosted - version: "3.11.0" - firebase_core_platform_interface: - dependency: transitive - description: - name: firebase_core_platform_interface - sha256: d7253d255ff10f85cfd2adaba9ac17bae878fa3ba577462451163bd9f1d1f0bf - url: "https://pub.dev" - source: hosted - version: "5.4.0" - firebase_core_web: - dependency: transitive - description: - name: firebase_core_web - sha256: "0e13c80f0de8acaa5d0519cbe23c8b4cc138a2d5d508b5755c861bdfc9762678" - url: "https://pub.dev" - source: hosted - version: "2.20.0" - firebase_crashlytics: - dependency: "direct main" - description: - name: firebase_crashlytics - sha256: "6273ed71bcd8a6fb4d0ca13d3abddbb3301796807efaad8782b5f90156f26f03" - url: "https://pub.dev" - source: hosted - version: "4.3.2" - firebase_crashlytics_platform_interface: - dependency: transitive - description: - name: firebase_crashlytics_platform_interface - sha256: "94f3986e1a10e5a883f2ad5e3d719aef98a8a0f9a49357f6e45b7d3696ea6a97" - url: "https://pub.dev" - source: hosted - version: "3.8.2" - firebase_database: - dependency: "direct main" - description: - name: firebase_database - sha256: cd2354dfef68e52c0713b5efbb7f4e10dfc2aff2f945c7bc8db34d1934170627 - url: "https://pub.dev" - source: hosted - version: "11.3.2" - firebase_database_platform_interface: - dependency: transitive - description: - name: firebase_database_platform_interface - sha256: d430983f4d877c9f72f88b3d715cca9a50021dd7ccd8e3ae6fb79603853317de - url: "https://pub.dev" - source: hosted - version: "0.2.6+2" - firebase_database_web: - dependency: transitive - description: - name: firebase_database_web - sha256: f64edae62c5beaa08e9e611a0736d64ab11a812983a0aa132695d2d191311ea7 - url: "https://pub.dev" - source: hosted - version: "0.2.6+8" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be - url: "https://pub.dev" - source: hosted - version: "1.1.1" - fl_chart: - dependency: "direct main" - description: - name: fl_chart - sha256: "94307bef3a324a0d329d3ab77b2f0c6e5ed739185ffc029ed28c0f9b019ea7ef" - url: "https://pub.dev" - source: hosted - version: "0.69.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_bloc: - dependency: "direct main" - description: - name: flutter_bloc - sha256: f0ecf6e6eb955193ca60af2d5ca39565a86b8a142452c5b24d96fb477428f4d2 - url: "https://pub.dev" - source: hosted - version: "8.1.5" - flutter_dotenv: - dependency: "direct main" - description: - name: flutter_dotenv - sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" - url: "https://pub.dev" - source: hosted - version: "5.1.0" - flutter_html: - dependency: "direct main" - description: - name: flutter_html - sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" - url: "https://pub.dev" - source: hosted - version: "3.0.0-beta.2" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - flutter_secure_storage: - dependency: "direct main" - description: - name: flutter_secure_storage - sha256: "165164745e6afb5c0e3e3fcc72a012fb9e58496fb26ffb92cf22e16a821e85d0" - url: "https://pub.dev" - source: hosted - version: "9.2.2" - flutter_secure_storage_linux: - dependency: transitive - description: - name: flutter_secure_storage_linux - sha256: "4d91bfc23047422cbcd73ac684bc169859ee766482517c22172c86596bf1464b" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - flutter_secure_storage_macos: - dependency: transitive - description: - name: flutter_secure_storage_macos - sha256: "1693ab11121a5f925bbea0be725abfcfbbcf36c1e29e571f84a0c0f436147a81" - url: "https://pub.dev" - source: hosted - version: "3.1.2" - flutter_secure_storage_platform_interface: - dependency: transitive - description: - name: flutter_secure_storage_platform_interface - sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 - url: "https://pub.dev" - source: hosted - version: "1.1.2" - flutter_secure_storage_web: - dependency: transitive - description: - name: flutter_secure_storage_web - sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - flutter_secure_storage_windows: - dependency: transitive - description: - name: flutter_secure_storage_windows - sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 - url: "https://pub.dev" - source: hosted - version: "3.1.2" - flutter_svg: - dependency: "direct main" - description: - name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" - url: "https://pub.dev" - source: hosted - version: "2.0.10+1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - get_it: - dependency: "direct main" - description: - name: get_it - sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 - url: "https://pub.dev" - source: hosted - version: "7.7.0" - go_router: - dependency: "direct main" - description: - name: go_router - sha256: "2ddb88e9ad56ae15ee144ed10e33886777eb5ca2509a914850a5faa7b52ff459" - url: "https://pub.dev" - source: hosted - version: "14.2.7" - graphview: - dependency: "direct main" - description: - name: graphview - sha256: bdba183583b23c30c71edea09ad5f0beef612572d3e39e855467a925bd08392f - url: "https://pub.dev" - source: hosted - version: "1.2.0" - html: - dependency: transitive - description: - name: html - sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" - url: "https://pub.dev" - source: hosted - version: "0.15.4" - http: - dependency: transitive - description: - name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 - url: "https://pub.dev" - source: hosted - version: "1.2.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - intl: - dependency: "direct main" - description: - name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf - url: "https://pub.dev" - source: hosted - version: "0.19.0" - intl_phone_field: - dependency: "direct main" - description: - name: intl_phone_field - sha256: "73819d3dfcb68d2c85663606f6842597c3ddf6688ac777f051b17814fe767bbf" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" - url: "https://pub.dev" - source: hosted - version: "10.0.7" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" - url: "https://pub.dev" - source: hosted - version: "3.0.8" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" - url: "https://pub.dev" - source: hosted - version: "3.0.1" - lints: - dependency: transitive - description: - name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 - url: "https://pub.dev" - source: hosted - version: "3.0.0" - list_counter: - dependency: transitive - description: - name: list_counter - sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 - url: "https://pub.dev" - source: hosted - version: "1.0.2" - logging: - dependency: transitive - description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.dev" - source: hosted - version: "0.12.16+1" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec - url: "https://pub.dev" - source: hosted - version: "0.11.1" - meta: - dependency: transitive - description: - name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.dev" - source: hosted - version: "1.15.0" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - number_pagination: - dependency: "direct main" - description: - name: number_pagination - sha256: "75d3a28616196e7c8df431d0fb7c48e811e462155f4cf3b5b4167b3408421327" - url: "https://pub.dev" - source: hosted - version: "1.1.6" - path: - dependency: transitive - description: - name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.dev" - source: hosted - version: "1.9.0" - path_parsing: - dependency: transitive - description: - name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf - url: "https://pub.dev" - source: hosted - version: "1.0.1" - path_provider: - dependency: transitive - description: - name: path_provider - sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 - url: "https://pub.dev" - source: hosted - version: "2.1.3" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - sha256: e84c8a53fe1510ef4582f118c7b4bdf15b03002b51d7c2b66983c65843d61193 - url: "https://pub.dev" - source: hosted - version: "2.2.8" - path_provider_foundation: - dependency: transitive - description: - name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 - url: "https://pub.dev" - source: hosted - version: "2.4.0" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" - source: hosted - version: "2.3.0" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.dev" - source: hosted - version: "6.0.2" - platform: - dependency: transitive - description: - name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" - url: "https://pub.dev" - source: hosted - version: "3.1.5" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" - url: "https://pub.dev" - source: hosted - version: "2.1.8" - provider: - dependency: transitive - description: - name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c - url: "https://pub.dev" - source: hosted - version: "6.1.2" - shared_preferences: - dependency: "direct main" - description: - name: shared_preferences - sha256: c3f888ba2d659f3e75f4686112cc1e71f46177f74452d40d8307edc332296ead - url: "https://pub.dev" - source: hosted - version: "2.3.0" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - sha256: "041be4d9d2dc6079cf342bc8b761b03787e3b71192d658220a56cac9c04a0294" - url: "https://pub.dev" - source: hosted - version: "2.3.0" - shared_preferences_foundation: - dependency: transitive - description: - name: shared_preferences_foundation - sha256: "671e7a931f55a08aa45be2a13fe7247f2a41237897df434b30d2012388191833" - url: "https://pub.dev" - source: hosted - version: "2.5.0" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - sha256: "2ba0510d3017f91655b7543e9ee46d48619de2a2af38e5c790423f7007c7ccc1" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e - url: "https://pub.dev" - source: hosted - version: "2.4.2" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - sha256: "398084b47b7f92110683cac45c6dc4aae853db47e470e5ddcd52cab7f7196ab2" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" - url: "https://pub.dev" - source: hosted - version: "1.12.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" - source: hosted - version: "2.1.2" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" - url: "https://pub.dev" - source: hosted - version: "0.7.3" - time_picker_spinner: - dependency: "direct main" - description: - name: time_picker_spinner - sha256: "53d824801d108890d22756501e7ade9db48b53dac1ec41580499dd4ebd128e3c" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - url_launcher: - dependency: "direct main" - description: - name: url_launcher - sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" - url: "https://pub.dev" - source: hosted - version: "6.3.1" - url_launcher_android: - dependency: transitive - description: - name: url_launcher_android - sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193" - url: "https://pub.dev" - source: hosted - version: "6.3.14" - url_launcher_ios: - dependency: transitive - description: - name: url_launcher_ios - sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626" - url: "https://pub.dev" - source: hosted - version: "6.3.2" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" - url: "https://pub.dev" - source: hosted - version: "3.2.2" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - sha256: "3ba963161bd0fe395917ba881d320b9c4f6dd3c4a233da62ab18a5025c85f1e9" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" - url: "https://pub.dev" - source: hosted - version: "3.1.4" - uuid: - dependency: "direct main" - description: - name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff - url: "https://pub.dev" - source: hosted - version: "4.5.1" - vector_graphics: - dependency: transitive - description: - name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" - url: "https://pub.dev" - source: hosted - version: "1.1.11+1" - vector_graphics_codec: - dependency: transitive - description: - name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da - url: "https://pub.dev" - source: hosted - version: "1.1.11+1" - vector_graphics_compiler: - dependency: transitive - description: - name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" - url: "https://pub.dev" - source: hosted - version: "1.1.11+1" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b - url: "https://pub.dev" - source: hosted - version: "14.3.0" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - win32: - dependency: transitive - description: - name: win32 - sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 - url: "https://pub.dev" - source: hosted - version: "5.5.1" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.dev" - source: hosted - version: "1.0.4" - xml: - dependency: transitive - description: - name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.dev" - source: hosted - version: "6.5.0" -sdks: - dart: ">=3.6.0 <4.0.0" - flutter: ">=3.27.0" From 4257f7f0f3d5200ba846bbd542f0dd29e98568fa Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Wed, 21 May 2025 09:55:17 +0300 Subject: [PATCH 10/11] Corrected color of titles in charts. --- .../analytics/models/analytics_device.dart | 86 ++++++++++--------- .../energy_management_charts_helper.dart | 2 +- .../widgets/analytics_device_dropdown.dart | 2 +- ...y_consumption_per_device_devices_list.dart | 2 +- .../occupancy/widgets/occupancy_chart.dart | 4 +- 5 files changed, 51 insertions(+), 45 deletions(-) diff --git a/lib/pages/analytics/models/analytics_device.dart b/lib/pages/analytics/models/analytics_device.dart index d2301e4a..88f18ec5 100644 --- a/lib/pages/analytics/models/analytics_device.dart +++ b/lib/pages/analytics/models/analytics_device.dart @@ -2,64 +2,70 @@ class AnalyticsDevice { const AnalyticsDevice({ required this.uuid, required this.name, - required this.createdAt, - required this.updatedAt, - required this.deviceTuyaUuid, - required this.isActive, - required this.productDevice, + this.createdAt, + this.updatedAt, + this.deviceTuyaUuid, + this.isActive, + this.productDevice, + this.spaceUuid, }); final String uuid; final String name; - final DateTime createdAt; - final DateTime updatedAt; - final String deviceTuyaUuid; - final bool isActive; - final ProductDevice productDevice; + final DateTime? createdAt; + final DateTime? updatedAt; + final String? deviceTuyaUuid; + final bool? isActive; + final ProductDevice? productDevice; + final String? spaceUuid; factory AnalyticsDevice.fromJson(Map json) { return AnalyticsDevice( - uuid: json['uuid'] as String? ?? '', - name: json['name'] as String? ?? '', - createdAt: DateTime.parse(json['createdAt'] as String? ?? ''), - updatedAt: DateTime.parse(json['updatedAt'] as String? ?? ''), - deviceTuyaUuid: json['deviceTuyaUuid'] as String? ?? '', - isActive: json['isActive'] as bool? ?? false, - productDevice: ProductDevice.fromJson( - json['productDevice'] as Map? ?? {}, - ), + uuid: json['uuid'] as String, + name: json['name'] as String, + createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt'] as String) : null, + updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt'] as String) : null, + deviceTuyaUuid: json['deviceTuyaUuid'] as String?, + isActive: json['isActive'] as bool?, + productDevice: json['productDevice'] != null + ? ProductDevice.fromJson(json['productDevice'] as Map) + : null, + spaceUuid: (json['spaces'] as List?) + ?.map((e) => e['uuid']) + .firstOrNull + ?.toString(), ); } } class ProductDevice { const ProductDevice({ - required this.uuid, - required this.createdAt, - required this.updatedAt, - required this.catName, - required this.prodId, - required this.name, - required this.prodType, + this.uuid, + this.createdAt, + this.updatedAt, + this.catName, + this.prodId, + this.name, + this.prodType, }); - final String uuid; - final DateTime createdAt; - final DateTime updatedAt; - final String catName; - final String prodId; - final String name; - final String prodType; + final String? uuid; + final DateTime? createdAt; + final DateTime? updatedAt; + final String? catName; + final String? prodId; + final String? name; + final String? prodType; factory ProductDevice.fromJson(Map json) { return ProductDevice( - uuid: json['uuid'] as String? ?? '', - createdAt: DateTime.parse(json['createdAt'] as String? ?? ''), - updatedAt: DateTime.parse(json['updatedAt'] as String? ?? ''), - catName: json['catName'] as String? ?? '', - prodId: json['prodId'] as String? ?? '', - name: json['name'] as String? ?? '', - prodType: json['prodType'] as String? ?? '', + uuid: json['uuid'] as String?, + createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt'] as String) : null, + updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt'] as String) : null, + catName: json['catName'] as String?, + prodId: json['prodId'] as String?, + name: json['name'] as String?, + prodType: json['prodType'] as String?, ); } } diff --git a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart index dadfc70f..567e03ed 100644 --- a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart +++ b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart @@ -27,7 +27,7 @@ abstract final class EnergyManagementChartsHelper { child: Text( value.toString(), style: context.textTheme.bodySmall?.copyWith( - color: ColorsManager.greyColor, + color: ColorsManager.lightGreyColor, fontSize: 12, ), ), diff --git a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart index 044cf1fb..4158da05 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart @@ -49,7 +49,7 @@ class AnalyticsDeviceDropdown extends StatelessWidget { } Widget _buildDevicesDropdown(BuildContext context, AnalyticsDevicesState state) { - final spaceUuid = context.read().state.selectedSpaces.firstOrNull; + final spaceUuid = state.selectedDevice?.spaceUuid; return DropdownButton( value: state.selectedDevice, isDense: true, diff --git a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart index 5ef434e1..e6996f53 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart @@ -41,7 +41,7 @@ class EnergyConsumptionPerDeviceDevicesList extends StatelessWidget { .color; return Tooltip( - message: '${device.name}\n${device.productDevice.uuid}', + message: '${device.name}\n${device.productDevice?.uuid ?? ''}', child: Container( height: MediaQuery.sizeOf(context).height * 0.0365, padding: const EdgeInsetsDirectional.symmetric( diff --git a/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart b/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart index 8a93ccf1..3e362f5d 100644 --- a/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart +++ b/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart @@ -19,7 +19,7 @@ class OccupancyChart extends StatelessWidget { maxY: 1.0, gridData: EnergyManagementChartsHelper.gridData().copyWith( checkToShowHorizontalLine: (value) => true, - horizontalInterval: 0.25, + horizontalInterval: 0.2, ), borderData: EnergyManagementChartsHelper.borderData(), barTouchData: _barTouchData(context), @@ -108,7 +108,7 @@ class OccupancyChart extends StatelessWidget { final leftTitles = titlesData.leftTitles.copyWith( sideTitles: titlesData.leftTitles.sideTitles.copyWith( reservedSize: 70, - interval: 0.25, + interval: 0.2, getTitlesWidget: (value, meta) => Padding( padding: const EdgeInsetsDirectional.only(end: 12), child: FittedBox( From 000fe7066389b808aac29c000053a83d6a79b69d Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Wed, 21 May 2025 09:59:50 +0300 Subject: [PATCH 11/11] format. --- .../energy_management/widgets/analytics_device_dropdown.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart index 4158da05..65157aa4 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/analytics/models/analytics_device.dart'; import 'package:syncrow_web/pages/analytics/modules/analytics/blocs/analytics_devices/analytics_devices_bloc.dart'; -import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart'; @@ -63,9 +62,7 @@ class AnalyticsDeviceDropdown extends StatelessWidget { style: _getTextStyle(context), padding: _defaultPadding, selectedItemBuilder: (context) { - return state.devices.map((e) { - return Text(e.name); - }).toList(); + return state.devices.map((e) => Text(e.name)).toList(); }, items: state.devices.map((e) { return DropdownMenuItem(