mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-26 23:47:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
818bdee745 |
@@ -1,8 +0,0 @@
|
|||||||
<svg width="175" height="134" viewBox="0 0 175 134" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<line x1="0.5" y1="2.18557e-08" x2="0.499994" y2="132.759" stroke="#B9C0C5"/>
|
|
||||||
<line x1="175" y1="133.259" x2="-4.37114e-08" y2="133.259" stroke="#B9C0C5"/>
|
|
||||||
<rect x="16.0922" y="66.3794" width="28.1609" height="66.3793" fill="#C7CDD1"/>
|
|
||||||
<rect x="54.3105" y="24.1379" width="28.1609" height="108.621" fill="#ABB4BA"/>
|
|
||||||
<rect x="92.5288" y="78.4484" width="28.1609" height="54.3103" fill="#C7CDD1"/>
|
|
||||||
<rect x="130.747" y="48.2759" width="28.1609" height="84.4828" fill="#ABB4BA"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 583 B |
@@ -1,5 +0,0 @@
|
|||||||
<svg width="175" height="134" viewBox="0 0 175 134" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<line x1="0.5" y1="3.05394e-05" x2="0.499994" y2="132.759" stroke="#B9C0C5"/>
|
|
||||||
<line x1="175" y1="133.259" x2="-4.37114e-08" y2="133.259" stroke="#B9C0C5"/>
|
|
||||||
<path d="M1.5 132.5C13 132.5 6.58852 66.5 29.5 66.5C46.5 66.5 46.1214 24.9349 68.5 24.5C94.2816 23.999 80.7136 78.5065 106.5 78.5C125.715 78.4952 131.5 48.5 145.5 48.5C159.5 48.5 156.5 96 171.5 96" stroke="#ABB4BA" stroke-width="2" stroke-linecap="round"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 520 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg width="175" height="134" viewBox="0 0 175 134" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<line x1="0.5" y1="2.18557e-08" x2="0.499994" y2="132.759" stroke="#B9C0C5"/>
|
|
||||||
<line x1="175" y1="133.259" x2="-4.37114e-08" y2="133.259" stroke="#B9C0C5"/>
|
|
||||||
<path d="M1.5 132.5C13 132.5 6.58852 66.5 29.5 66.5C46.5 66.5 46.1214 24.9348 68.5 24.5C94.2816 23.999 80.7136 78.5064 106.5 78.5C125.715 78.4951 131.5 48.5 145.5 48.5C159.5 48.5 156.5 95.9999 171.5 95.9999" stroke="#ABB4BA" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="4 4"/>
|
|
||||||
<path d="M1.5 132.5C13 132.5 6.58852 78.4999 29.5 78.4999C46.5 78.4999 45.6214 44.9349 68 44.5C93.7816 43.999 80.7136 27.0065 106.5 27C125.715 26.9952 131.5 63.5 145.5 63.5C159.5 63.5 156.5 113.5 171.5 113.5" stroke="#C7CDD1" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="4 4"/>
|
|
||||||
<path d="M1.5 132.5C13 132.5 6.58852 85.9999 29.5 85.9999C46.5 85.9999 45.6214 11.9348 68 11.4999C93.7816 10.9989 80.7136 43.5064 106.5 43.4999C125.715 43.4951 131.5 35.4999 145.5 35.4999C159.5 35.4999 156.5 105.5 171.5 105.5" stroke="#D5D5D5" stroke-width="1.5" stroke-linecap="round" stroke-dasharray="4 4"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,99 +0,0 @@
|
|||||||
<svg width="181" height="121" viewBox="0 0 181 121" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<line x1="15.5" y1="-2.52181e-08" x2="15.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="45.5" y1="-2.52181e-08" x2="45.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="75.5" y1="-2.52181e-08" x2="75.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="105.5" y1="-2.52181e-08" x2="105.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="135.5" y1="-2.52181e-08" x2="135.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="165.5" y1="-2.52181e-08" x2="165.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="30.5" y1="-2.52181e-08" x2="30.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="60.5" y1="-2.52181e-08" x2="60.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="90.5" y1="-2.52181e-08" x2="90.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="120.5" y1="-2.52181e-08" x2="120.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="150.5" y1="-2.52181e-08" x2="150.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="180.5" y1="-2.52181e-08" x2="180.5" y2="120" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="120.5" x2="-4.52101e-08" y2="120.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="60.5" x2="-4.52101e-08" y2="60.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="90.5" x2="-4.52101e-08" y2="90.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="30.5" x2="-4.52101e-08" y2="30.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="105.5" x2="-4.52101e-08" y2="105.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="45.5" x2="-4.52101e-08" y2="45.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="75.5" x2="-4.52101e-08" y2="75.5" stroke="#B9B9B9"/>
|
|
||||||
<line x1="181" y1="15.5" x2="-4.52101e-08" y2="15.5" stroke="#B9B9B9"/>
|
|
||||||
<rect x="16" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="46" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="61" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="76" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="91" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="106" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="121" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="136" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="151" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="166" y="16" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="16" y="31" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="46" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="61" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="76" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="91" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="106" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="121" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="136" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="151" y="31" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="166" y="31" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="16" y="46" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="46" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="61" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="76" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="91" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="106" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="121" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="136" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="151" y="46" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="166" y="46" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="16" y="61" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="61" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="46" y="61" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="61" y="61" width="14" height="14" fill="#B1B1B1"/>
|
|
||||||
<rect x="76" y="61" width="14" height="14" fill="#B1B1B1"/>
|
|
||||||
<rect x="91" y="61" width="14" height="14" fill="#B1B1B1"/>
|
|
||||||
<rect x="106" y="61" width="14" height="14" fill="#B1B1B1"/>
|
|
||||||
<rect x="121" y="61" width="14" height="14" fill="#B1B1B1"/>
|
|
||||||
<rect x="136" y="61" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="151" y="61" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="166" y="61" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="16" y="76" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="46" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="61" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="76" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="91" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="106" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="121" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="136" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="151" y="76" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="166" y="76" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="16" y="91" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="46" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="61" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="76" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="91" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="106" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="121" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="136" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="151" y="91" width="14" height="14" fill="#D5D5D5"/>
|
|
||||||
<rect x="166" y="91" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="16" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="31" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="46" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="61" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="76" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="91" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="106" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="121" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="136" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="151" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
<rect x="166" y="106" width="14" height="14" fill="#F2F2F2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 6.1 KiB |
@@ -1,7 +0,0 @@
|
|||||||
<svg width="175" height="134" viewBox="0 0 175 134" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<line x1="0.5" y1="2.18557e-08" x2="0.499994" y2="132.759" stroke="#B9C0C5"/>
|
|
||||||
<line x1="175" y1="133.259" x2="-4.37114e-08" y2="133.259" stroke="#B9C0C5"/>
|
|
||||||
<path d="M1.5 95.9999C13 95.9999 6.58853 66.4999 29.5 66.4999C46.5 66.4999 46.1214 34.9348 68.5 34.4999C94.2816 33.9989 80.7136 65.0065 106.5 65C125.715 64.9952 131.5 50.5 145.5 50.5C159.5 50.5 156.5 70.5 171.5 70.5" stroke="#C7CDD1" stroke-width="2" stroke-linecap="round"/>
|
|
||||||
<path d="M1.5 106C13 106 6.58853 76.4999 29.5 76.4999C46.5 76.4999 46.1214 44.9348 68.5 44.4999C94.2816 43.9989 80.7136 75.0065 106.5 75C125.715 74.9952 131.5 60.5 145.5 60.5C159.5 60.5 156.5 80.5 171.5 80.5" stroke="#F2F2F2" stroke-width="2" stroke-linecap="round"/>
|
|
||||||
<path d="M1.5 116C13 116 6.58853 86.4999 29.5 86.4999C46.5 86.4999 46.1214 54.9348 68.5 54.4999C94.2816 53.9989 80.7136 85.0065 106.5 85C125.715 84.9952 131.5 70.5 145.5 70.5C159.5 70.5 156.5 90.5 171.5 90.5" stroke="#ABB4BA" stroke-width="2" stroke-linecap="round"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -39,12 +39,8 @@ class AnalyticsDevice {
|
|||||||
? ProductDevice.fromJson(json['productDevice'] as Map<String, dynamic>)
|
? ProductDevice.fromJson(json['productDevice'] as Map<String, dynamic>)
|
||||||
: null,
|
: null,
|
||||||
spaceUuid: json['spaceUuid'] as String?,
|
spaceUuid: json['spaceUuid'] as String?,
|
||||||
latitude: json['lat'] != null && json['lat'] != ''
|
latitude: json['lat'] != null ? double.parse(json['lat'] as String? ?? '0.0') : null,
|
||||||
? double.tryParse(json['lat']?.toString() ?? '0.0')
|
longitude: json['lon'] != null ? double.parse(json['lon'] as String? ?? '0.0') : null,
|
||||||
: null,
|
|
||||||
longitude: json['lon'] != null && json['lon'] != ''
|
|
||||||
? double.tryParse(json['lon']?.toString() ?? '0.0')
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -46,11 +46,11 @@ class AirQualityDistributionBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onClearAirQualityDistribution(
|
Future<void> _onClearAirQualityDistribution(
|
||||||
ClearAirQualityDistribution event,
|
ClearAirQualityDistribution event,
|
||||||
Emitter<AirQualityDistributionState> emit,
|
Emitter<AirQualityDistributionState> emit,
|
||||||
) {
|
) async {
|
||||||
emit(AirQualityDistributionState(selectedAqiType: state.selectedAqiType));
|
emit(const AirQualityDistributionState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onUpdateAqiTypeEvent(
|
void _onUpdateAqiTypeEvent(
|
||||||
|
|||||||
@@ -75,6 +75,6 @@ class RangeOfAqiBloc extends Bloc<RangeOfAqiEvent, RangeOfAqiState> {
|
|||||||
ClearRangeOfAqiEvent event,
|
ClearRangeOfAqiEvent event,
|
||||||
Emitter<RangeOfAqiState> emit,
|
Emitter<RangeOfAqiState> emit,
|
||||||
) {
|
) {
|
||||||
emit(RangeOfAqiState(selectedAqiType: state.selectedAqiType));
|
emit(const RangeOfAqiState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/air_quality_distribution/air_quality_distribution_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/air_quality_distribution/air_quality_distribution_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart_title.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart_title.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_chart_empty_state_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class AqiDistributionChartBox extends StatelessWidget {
|
class AqiDistributionChartBox extends StatelessWidget {
|
||||||
@@ -34,20 +32,8 @@ class AqiDistributionChartBox extends StatelessWidget {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Visibility(
|
Expanded(
|
||||||
visible: state.chartData.isNotEmpty,
|
child: AqiDistributionChart(chartData: state.chartData),
|
||||||
replacement: AnalyticsChartEmptyStateWidget(
|
|
||||||
isLoading: state.status == AirQualityDistributionStatus.loading,
|
|
||||||
isError: state.status == AirQualityDistributionStatus.failure,
|
|
||||||
isInitial: state.status == AirQualityDistributionStatus.initial,
|
|
||||||
errorMessage: state.errorMessage,
|
|
||||||
iconPath: Assets.emptyBarredChart,
|
|
||||||
),
|
|
||||||
child: Expanded(
|
|
||||||
child: AqiDistributionChart(
|
|
||||||
chartData: state.chartData,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class AqiDistributionChartTitle extends StatelessWidget {
|
|||||||
alignment: AlignmentDirectional.centerEnd,
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
child: AqiTypeDropdown(
|
child: AqiTypeDropdown(
|
||||||
selectedAqiType: context.watch<AirQualityDistributionBloc>().state.selectedAqiType,
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
final bloc = context.read<AirQualityDistributionBloc>();
|
final bloc = context.read<AirQualityDistributionBloc>();
|
||||||
|
|||||||
@@ -18,20 +18,19 @@ enum AqiType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AqiTypeDropdown extends StatefulWidget {
|
class AqiTypeDropdown extends StatefulWidget {
|
||||||
const AqiTypeDropdown({
|
const AqiTypeDropdown({super.key, required this.onChanged});
|
||||||
required this.onChanged,
|
|
||||||
this.selectedAqiType,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
final ValueChanged<AqiType?> onChanged;
|
final ValueChanged<AqiType?> onChanged;
|
||||||
final AqiType? selectedAqiType;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AqiTypeDropdown> createState() => _AqiTypeDropdownState();
|
State<AqiTypeDropdown> createState() => _AqiTypeDropdownState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AqiTypeDropdownState extends State<AqiTypeDropdown> {
|
class _AqiTypeDropdownState extends State<AqiTypeDropdown> {
|
||||||
|
AqiType? _selectedItem = AqiType.aqi;
|
||||||
|
|
||||||
|
void _updateSelectedItem(AqiType? item) => setState(() => _selectedItem = item);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
@@ -42,8 +41,8 @@ class _AqiTypeDropdownState extends State<AqiTypeDropdown> {
|
|||||||
width: 1,
|
width: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: DropdownButton<AqiType>(
|
child: DropdownButton<AqiType?>(
|
||||||
value: widget.selectedAqiType,
|
value: _selectedItem,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
dropdownColor: ColorsManager.whiteColors,
|
dropdownColor: ColorsManager.whiteColors,
|
||||||
@@ -60,7 +59,10 @@ class _AqiTypeDropdownState extends State<AqiTypeDropdown> {
|
|||||||
items: AqiType.values
|
items: AqiType.values
|
||||||
.map((e) => DropdownMenuItem(value: e, child: Text(e.value)))
|
.map((e) => DropdownMenuItem(value: e, child: Text(e.value)))
|
||||||
.toList(),
|
.toList(),
|
||||||
onChanged: widget.onChanged,
|
onChanged: (value) {
|
||||||
|
_updateSelectedItem(value);
|
||||||
|
widget.onChanged(value);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/range_of_aqi/range_of_aqi_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/range_of_aqi/range_of_aqi_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart_title.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart_title.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_chart_empty_state_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class RangeOfAqiChartBox extends StatelessWidget {
|
class RangeOfAqiChartBox extends StatelessWidget {
|
||||||
@@ -34,20 +32,10 @@ class RangeOfAqiChartBox extends StatelessWidget {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Visibility(
|
Expanded(
|
||||||
visible: state.filteredRangeOfAqi.isNotEmpty,
|
child: RangeOfAqiChart(
|
||||||
replacement: AnalyticsChartEmptyStateWidget(
|
chartData: state.filteredRangeOfAqi,
|
||||||
isLoading: state.status == RangeOfAqiStatus.loading,
|
selectedAqiType: state.selectedAqiType,
|
||||||
isError: state.status == RangeOfAqiStatus.failure,
|
|
||||||
isInitial: state.status == RangeOfAqiStatus.initial,
|
|
||||||
errorMessage: state.errorMessage,
|
|
||||||
iconPath: Assets.emptyRangeOfAqi,
|
|
||||||
),
|
|
||||||
child: Expanded(
|
|
||||||
child: RangeOfAqiChart(
|
|
||||||
chartData: state.filteredRangeOfAqi,
|
|
||||||
selectedAqiType: state.selectedAqiType,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -63,15 +63,15 @@ class RangeOfAqiChartTitle extends StatelessWidget {
|
|||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
child: AqiTypeDropdown(
|
child: AqiTypeDropdown(
|
||||||
selectedAqiType: context.watch<RangeOfAqiBloc>().state.selectedAqiType,
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
||||||
final spaceUuid = spaceTreeState.selectedSpaces.firstOrNull;
|
final spaceUuid = spaceTreeState.selectedSpaces.firstOrNull;
|
||||||
|
|
||||||
|
if (spaceUuid == null) return;
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
context.read<RangeOfAqiBloc>().add(UpdateAqiTypeEvent(value));
|
context.read<RangeOfAqiBloc>().add(UpdateAqiTypeEvent(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spaceUuid == null) return;
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
+2
-20
@@ -5,10 +5,8 @@ import 'package:syncrow_web/pages/analytics/modules/energy_management/blocs/ener
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/chart_title.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';
|
import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_chart.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart';
|
import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/energy_consumption_per_device_devices_list.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_chart_empty_state_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/charts_loading_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/charts_loading_widget.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
|
class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
|
||||||
@@ -56,24 +54,8 @@ class EnergyConsumptionPerDeviceChartBox extends StatelessWidget {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Divider(height: 0),
|
const Divider(height: 0),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Visibility(
|
Expanded(
|
||||||
visible: state.chartData.isNotEmpty &&
|
child: EnergyConsumptionPerDeviceChart(chartData: state.chartData),
|
||||||
state.chartData
|
|
||||||
.every((e) => e.energy.every((e) => e.value != 0)),
|
|
||||||
replacement: AnalyticsChartEmptyStateWidget(
|
|
||||||
isLoading:
|
|
||||||
state.status == EnergyConsumptionPerDeviceStatus.loading,
|
|
||||||
isError: state.status == EnergyConsumptionPerDeviceStatus.failure,
|
|
||||||
isInitial:
|
|
||||||
state.status == EnergyConsumptionPerDeviceStatus.initial,
|
|
||||||
errorMessage: state.errorMessage,
|
|
||||||
iconPath: Assets.emptyEnergyManagementPerDevice,
|
|
||||||
),
|
|
||||||
child: Expanded(
|
|
||||||
child: EnergyConsumptionPerDeviceChart(
|
|
||||||
chartData: state.chartData,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
+1
-14
@@ -3,10 +3,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/energy_management/blocs/total_energy_consumption/total_energy_consumption_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/energy_management/blocs/total_energy_consumption/total_energy_consumption_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/chart_title.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/total_energy_consumption_chart.dart';
|
import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/total_energy_consumption_chart.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_chart_empty_state_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/charts_loading_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/charts_loading_widget.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class TotalEnergyConsumptionChartBox extends StatelessWidget {
|
class TotalEnergyConsumptionChartBox extends StatelessWidget {
|
||||||
@@ -43,18 +41,7 @@ class TotalEnergyConsumptionChartBox extends StatelessWidget {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Visibility(
|
TotalEnergyConsumptionChart(chartData: state.chartData),
|
||||||
visible: state.chartData.isNotEmpty &&
|
|
||||||
state.chartData.every((e) => e.value != 0),
|
|
||||||
replacement: AnalyticsChartEmptyStateWidget(
|
|
||||||
isLoading: state.status == TotalEnergyConsumptionStatus.loading,
|
|
||||||
isError: state.status == TotalEnergyConsumptionStatus.failure,
|
|
||||||
isInitial: state.status == TotalEnergyConsumptionStatus.initial,
|
|
||||||
errorMessage: state.errorMessage,
|
|
||||||
iconPath: Assets.emptyEnergyManagementChart,
|
|
||||||
),
|
|
||||||
child: TotalEnergyConsumptionChart(chartData: state.chartData),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/ch
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/occupancy/blocs/occupancy/occupancy_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/occupancy/blocs/occupancy/occupancy_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/occupancy/helpers/fetch_occupancy_data_helper.dart';
|
import 'package:syncrow_web/pages/analytics/modules/occupancy/helpers/fetch_occupancy_data_helper.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart';
|
import 'package:syncrow_web/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_chart_empty_state_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class OccupancyChartBox extends StatelessWidget {
|
class OccupancyChartBox extends StatelessWidget {
|
||||||
@@ -69,24 +67,7 @@ class OccupancyChartBox extends StatelessWidget {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Visibility(
|
Expanded(child: OccupancyChart(chartData: state.chartData)),
|
||||||
visible: state.chartData.isNotEmpty &&
|
|
||||||
state.chartData.every(
|
|
||||||
(e) => e.occupancy.isNotEmpty,
|
|
||||||
),
|
|
||||||
replacement: AnalyticsChartEmptyStateWidget(
|
|
||||||
isLoading: state.status == OccupancyStatus.loading,
|
|
||||||
isError: state.status == OccupancyStatus.failure,
|
|
||||||
isInitial: state.status == OccupancyStatus.initial,
|
|
||||||
errorMessage: state.errorMessage,
|
|
||||||
iconPath: Assets.emptyBarredChart,
|
|
||||||
),
|
|
||||||
child: Expanded(
|
|
||||||
child: OccupancyChart(
|
|
||||||
chartData: state.chartData,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import 'package:syncrow_web/pages/analytics/modules/energy_management/widgets/ch
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/occupancy/blocs/occupancy_heat_map/occupancy_heat_map_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/occupancy/blocs/occupancy_heat_map/occupancy_heat_map_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/occupancy/helpers/fetch_occupancy_data_helper.dart';
|
import 'package:syncrow_web/pages/analytics/modules/occupancy/helpers/fetch_occupancy_data_helper.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/occupancy/widgets/occupancy_heat_map.dart';
|
import 'package:syncrow_web/pages/analytics/modules/occupancy/widgets/occupancy_heat_map.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_chart_empty_state_widget.dart';
|
|
||||||
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
import 'package:syncrow_web/pages/analytics/widgets/analytics_error_widget.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class OccupancyHeatMapBox extends StatelessWidget {
|
class OccupancyHeatMapBox extends StatelessWidget {
|
||||||
@@ -70,29 +68,16 @@ class OccupancyHeatMapBox extends StatelessWidget {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Visibility(
|
Expanded(
|
||||||
visible: state.heatMapData.isNotEmpty &&
|
child: OccupancyHeatMap(
|
||||||
state.heatMapData.every(
|
selectedDate:
|
||||||
(e) => e.countTotalPresenceDetected != 0,
|
context.watch<AnalyticsDatePickerBloc>().state.yearlyDate,
|
||||||
),
|
heatMapData: state.heatMapData.asMap().map(
|
||||||
replacement: AnalyticsChartEmptyStateWidget(
|
(_, value) => MapEntry(
|
||||||
isLoading: state.status == OccupancyHeatMapStatus.loading,
|
value.eventDate,
|
||||||
isError: state.status == OccupancyHeatMapStatus.failure,
|
value.countTotalPresenceDetected,
|
||||||
isInitial: state.status == OccupancyHeatMapStatus.initial,
|
|
||||||
errorMessage: state.errorMessage,
|
|
||||||
iconPath: Assets.emptyHeatmap,
|
|
||||||
),
|
|
||||||
child: Expanded(
|
|
||||||
child: OccupancyHeatMap(
|
|
||||||
selectedDate:
|
|
||||||
context.watch<AnalyticsDatePickerBloc>().state.yearlyDate,
|
|
||||||
heatMapData: state.heatMapData.asMap().map(
|
|
||||||
(_, value) => MapEntry(
|
|
||||||
value.eventDate,
|
|
||||||
value.countTotalPresenceDetected,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_svg/svg.dart';
|
|
||||||
import 'package:syncrow_web/common/widgets/app_loading_indicator.dart';
|
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
|
||||||
|
|
||||||
class AnalyticsChartEmptyStateWidget extends StatelessWidget {
|
|
||||||
const AnalyticsChartEmptyStateWidget({
|
|
||||||
required this.iconPath,
|
|
||||||
this.isLoading = false,
|
|
||||||
this.isError = false,
|
|
||||||
this.isInitial = false,
|
|
||||||
this.errorMessage,
|
|
||||||
this.noDataMessage = 'No data to display',
|
|
||||||
this.initialMessage = 'Please select a space to see data',
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
final bool isLoading;
|
|
||||||
final bool isError;
|
|
||||||
final bool isInitial;
|
|
||||||
final String? errorMessage;
|
|
||||||
final String noDataMessage;
|
|
||||||
final String initialMessage;
|
|
||||||
final String iconPath;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Expanded(
|
|
||||||
child: _buildWidgetBasedOnState(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildWidgetBasedOnState(BuildContext context) {
|
|
||||||
final widgetsMap = {
|
|
||||||
isLoading: const AppLoadingIndicator(),
|
|
||||||
isInitial: _buildState(context, initialMessage),
|
|
||||||
isError: _buildState(context, errorMessage ?? 'Something went wrong'),
|
|
||||||
};
|
|
||||||
|
|
||||||
return widgetsMap[true] ?? _buildState(context, noDataMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildState(BuildContext context, String message) {
|
|
||||||
return Center(
|
|
||||||
child: Column(
|
|
||||||
spacing: 16,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Expanded(child: SvgPicture.asset(iconPath, fit: BoxFit.contain)),
|
|
||||||
SelectableText(
|
|
||||||
message,
|
|
||||||
style: isError
|
|
||||||
? context.textTheme.bodyMedium?.copyWith(
|
|
||||||
color: ColorsManager.red,
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+21
-153
@@ -16,12 +16,11 @@ class DeviceManagementBloc
|
|||||||
int _onlineCount = 0;
|
int _onlineCount = 0;
|
||||||
int _offlineCount = 0;
|
int _offlineCount = 0;
|
||||||
int _lowBatteryCount = 0;
|
int _lowBatteryCount = 0;
|
||||||
final List<AllDevicesModel> _selectedDevices = [];
|
List<AllDevicesModel> _selectedDevices = [];
|
||||||
List<AllDevicesModel> _filteredDevices = [];
|
List<AllDevicesModel> _filteredDevices = [];
|
||||||
String currentProductName = '';
|
String currentProductName = '';
|
||||||
String? currentCommunity;
|
String? currentCommunity;
|
||||||
String? currentUnitName;
|
String? currentUnitName;
|
||||||
String subSpaceName = '';
|
|
||||||
|
|
||||||
DeviceManagementBloc() : super(DeviceManagementInitial()) {
|
DeviceManagementBloc() : super(DeviceManagementInitial()) {
|
||||||
on<FetchDevices>(_onFetchDevices);
|
on<FetchDevices>(_onFetchDevices);
|
||||||
@@ -32,29 +31,24 @@ class DeviceManagementBloc
|
|||||||
on<ResetFilters>(_onResetFilters);
|
on<ResetFilters>(_onResetFilters);
|
||||||
on<ResetSelectedDevices>(_onResetSelectedDevices);
|
on<ResetSelectedDevices>(_onResetSelectedDevices);
|
||||||
on<UpdateSelection>(_onUpdateSelection);
|
on<UpdateSelection>(_onUpdateSelection);
|
||||||
on<UpdateDeviceName>(_onUpdateDeviceName);
|
|
||||||
on<UpdateSubSpaceName>(_onUpdateSubSpaceName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onFetchDevices(
|
Future<void> _onFetchDevices(
|
||||||
FetchDevices event, Emitter<DeviceManagementState> emit) async {
|
FetchDevices event, Emitter<DeviceManagementState> emit) async {
|
||||||
emit(DeviceManagementLoading());
|
emit(DeviceManagementLoading());
|
||||||
try {
|
try {
|
||||||
var devices = <AllDevicesModel>[];
|
List<AllDevicesModel> devices = [];
|
||||||
_devices.clear();
|
_devices.clear();
|
||||||
final spaceBloc = event.context.read<SpaceTreeBloc>();
|
var spaceBloc = event.context.read<SpaceTreeBloc>();
|
||||||
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
|
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
|
||||||
|
|
||||||
if (spaceBloc.state.selectedCommunities.isEmpty) {
|
if (spaceBloc.state.selectedCommunities.isEmpty) {
|
||||||
devices = await DevicesManagementApi().fetchDevices('', '', projectUuid);
|
devices = await DevicesManagementApi().fetchDevices(projectUuid);
|
||||||
} else {
|
} else {
|
||||||
for (final community in spaceBloc.state.selectedCommunities) {
|
for (var community in spaceBloc.state.selectedCommunities) {
|
||||||
final spacesList =
|
List<String> spacesList =
|
||||||
spaceBloc.state.selectedCommunityAndSpaces[community] ?? [];
|
spaceBloc.state.selectedCommunityAndSpaces[community] ?? [];
|
||||||
for (final space in spacesList) {
|
devices.addAll(await DevicesManagementApi()
|
||||||
devices.addAll(await DevicesManagementApi()
|
.fetchDevices(projectUuid, spacesId: spacesList));
|
||||||
.fetchDevices(community, space, projectUuid));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +70,7 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onFilterDevices(
|
void _onFilterDevices(
|
||||||
FilterDevices event, Emitter<DeviceManagementState> emit) async {
|
FilterDevices event, Emitter<DeviceManagementState> emit) async {
|
||||||
if (_devices.isNotEmpty) {
|
if (_devices.isNotEmpty) {
|
||||||
_filteredDevices = List.from(_devices.where((device) {
|
_filteredDevices = List.from(_devices.where((device) {
|
||||||
@@ -158,7 +152,8 @@ class DeviceManagementBloc
|
|||||||
add(FilterDevices(_getFilterFromIndex(_selectedIndex)));
|
add(FilterDevices(_getFilterFromIndex(_selectedIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSelectDevice(SelectDevice event, Emitter<DeviceManagementState> emit) {
|
void _onSelectDevice(
|
||||||
|
SelectDevice event, Emitter<DeviceManagementState> emit) {
|
||||||
final selectedUuid = event.selectedDevice.uuid;
|
final selectedUuid = event.selectedDevice.uuid;
|
||||||
|
|
||||||
if (_selectedDevices.any((device) => device.uuid == selectedUuid)) {
|
if (_selectedDevices.any((device) => device.uuid == selectedUuid)) {
|
||||||
@@ -167,9 +162,9 @@ class DeviceManagementBloc
|
|||||||
_selectedDevices.add(event.selectedDevice);
|
_selectedDevices.add(event.selectedDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
final clonedSelectedDevices = List<AllDevicesModel>.from(_selectedDevices);
|
List<AllDevicesModel> clonedSelectedDevices = List.from(_selectedDevices);
|
||||||
|
|
||||||
final isControlButtonEnabled =
|
bool isControlButtonEnabled =
|
||||||
_checkIfControlButtonEnabled(clonedSelectedDevices);
|
_checkIfControlButtonEnabled(clonedSelectedDevices);
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
if (state is DeviceManagementLoaded) {
|
||||||
@@ -199,8 +194,8 @@ class DeviceManagementBloc
|
|||||||
|
|
||||||
void _onUpdateSelection(
|
void _onUpdateSelection(
|
||||||
UpdateSelection event, Emitter<DeviceManagementState> emit) {
|
UpdateSelection event, Emitter<DeviceManagementState> emit) {
|
||||||
final selectedDevices = <AllDevicesModel>[];
|
List<AllDevicesModel> selectedDevices = [];
|
||||||
var devicesToSelectFrom = <AllDevicesModel>[];
|
List<AllDevicesModel> devicesToSelectFrom = [];
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
if (state is DeviceManagementLoaded) {
|
||||||
devicesToSelectFrom = (state as DeviceManagementLoaded).devices;
|
devicesToSelectFrom = (state as DeviceManagementLoaded).devices;
|
||||||
@@ -208,7 +203,7 @@ class DeviceManagementBloc
|
|||||||
devicesToSelectFrom = (state as DeviceManagementFiltered).filteredDevices;
|
devicesToSelectFrom = (state as DeviceManagementFiltered).filteredDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < event.selectedRows.length; i++) {
|
for (int i = 0; i < event.selectedRows.length; i++) {
|
||||||
if (event.selectedRows[i]) {
|
if (event.selectedRows[i]) {
|
||||||
selectedDevices.add(devicesToSelectFrom[i]);
|
selectedDevices.add(devicesToSelectFrom[i]);
|
||||||
}
|
}
|
||||||
@@ -254,7 +249,8 @@ class DeviceManagementBloc
|
|||||||
_onlineCount = _devices.where((device) => device.online == true).length;
|
_onlineCount = _devices.where((device) => device.online == true).length;
|
||||||
_offlineCount = _devices.where((device) => device.online == false).length;
|
_offlineCount = _devices.where((device) => device.online == false).length;
|
||||||
_lowBatteryCount = _devices
|
_lowBatteryCount = _devices
|
||||||
.where((device) => device.batteryLevel != null && device.batteryLevel! < 20)
|
.where((device) =>
|
||||||
|
device.batteryLevel != null && device.batteryLevel! < 20)
|
||||||
.length;
|
.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +267,8 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSearchDevices(SearchDevices event, Emitter<DeviceManagementState> emit) {
|
void _onSearchDevices(
|
||||||
|
SearchDevices event, Emitter<DeviceManagementState> emit) {
|
||||||
if ((event.community == null || event.community!.isEmpty) &&
|
if ((event.community == null || event.community!.isEmpty) &&
|
||||||
(event.unitName == null || event.unitName!.isEmpty) &&
|
(event.unitName == null || event.unitName!.isEmpty) &&
|
||||||
(event.deviceNameOrProductName == null ||
|
(event.deviceNameOrProductName == null ||
|
||||||
@@ -300,7 +297,7 @@ class DeviceManagementBloc
|
|||||||
currentCommunity = event.community;
|
currentCommunity = event.community;
|
||||||
currentUnitName = event.unitName;
|
currentUnitName = event.unitName;
|
||||||
|
|
||||||
final devicesToSearch = _devices;
|
List<AllDevicesModel> devicesToSearch = _devices;
|
||||||
|
|
||||||
if (devicesToSearch.isNotEmpty) {
|
if (devicesToSearch.isNotEmpty) {
|
||||||
final searchText = event.deviceNameOrProductName?.toLowerCase() ?? '';
|
final searchText = event.deviceNameOrProductName?.toLowerCase() ?? '';
|
||||||
@@ -343,134 +340,5 @@ class DeviceManagementBloc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onUpdateDeviceName(
|
|
||||||
UpdateDeviceName event, Emitter<DeviceManagementState> emit) {
|
|
||||||
final devices = _devices.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
final modifiedDevice = device.copyWith(name: event.newName);
|
|
||||||
_selectedDevices.removeWhere((device) => device.uuid == event.deviceId);
|
|
||||||
_selectedDevices.add(modifiedDevice);
|
|
||||||
return modifiedDevice;
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
final filteredDevices = _filteredDevices.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
final modifiedDevice = device.copyWith(name: event.newName);
|
|
||||||
_selectedDevices.removeWhere((device) => device.uuid == event.deviceId);
|
|
||||||
_selectedDevices.add(modifiedDevice);
|
|
||||||
return modifiedDevice;
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
_devices = devices;
|
|
||||||
_filteredDevices = filteredDevices;
|
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
|
||||||
final loaded = state as DeviceManagementLoaded;
|
|
||||||
final selectedDevices01 = _selectedDevices.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
final modifiedDevice = device.copyWith(name: event.newName);
|
|
||||||
return modifiedDevice;
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
emit(DeviceManagementLoaded(
|
|
||||||
devices: devices,
|
|
||||||
selectedIndex: loaded.selectedIndex,
|
|
||||||
onlineCount: loaded.onlineCount,
|
|
||||||
offlineCount: loaded.offlineCount,
|
|
||||||
lowBatteryCount: loaded.lowBatteryCount,
|
|
||||||
selectedDevice: selectedDevices01,
|
|
||||||
isControlButtonEnabled: loaded.isControlButtonEnabled,
|
|
||||||
));
|
|
||||||
} else if (state is DeviceManagementFiltered) {
|
|
||||||
final filtered = state as DeviceManagementFiltered;
|
|
||||||
final selectedDevices01 = filtered.selectedDevice?.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
final modifiedDevice = device.copyWith(name: event.newName);
|
|
||||||
return modifiedDevice;
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
emit(DeviceManagementFiltered(
|
|
||||||
filteredDevices: filteredDevices,
|
|
||||||
selectedIndex: filtered.selectedIndex,
|
|
||||||
onlineCount: filtered.onlineCount,
|
|
||||||
offlineCount: filtered.offlineCount,
|
|
||||||
lowBatteryCount: filtered.lowBatteryCount,
|
|
||||||
selectedDevice: selectedDevices01,
|
|
||||||
isControlButtonEnabled: filtered.isControlButtonEnabled,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onUpdateSubSpaceName(
|
|
||||||
UpdateSubSpaceName event, Emitter<DeviceManagementState> emit) {
|
|
||||||
final devices = _devices.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
return device.copyWith(
|
|
||||||
subspace:
|
|
||||||
device.subspace?.copyWith(subspaceName: event.newSubSpaceName));
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
final filteredDevices = _filteredDevices.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
return device.copyWith(
|
|
||||||
subspace:
|
|
||||||
device.subspace?.copyWith(subspaceName: event.newSubSpaceName));
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
_devices = devices;
|
|
||||||
_filteredDevices = filteredDevices;
|
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
|
||||||
final loaded = state as DeviceManagementLoaded;
|
|
||||||
final selectedDevices = loaded.selectedDevice?.map((device) {
|
|
||||||
if (device.uuid == event.deviceId) {
|
|
||||||
return device.copyWith(
|
|
||||||
subspace:
|
|
||||||
device.subspace?.copyWith(subspaceName: event.newSubSpaceName));
|
|
||||||
}
|
|
||||||
return device;
|
|
||||||
}).toList();
|
|
||||||
emit(DeviceManagementLoaded(
|
|
||||||
devices: _devices,
|
|
||||||
selectedIndex: loaded.selectedIndex,
|
|
||||||
onlineCount: loaded.onlineCount,
|
|
||||||
offlineCount: loaded.offlineCount,
|
|
||||||
lowBatteryCount: loaded.lowBatteryCount,
|
|
||||||
selectedDevice: selectedDevices,
|
|
||||||
isControlButtonEnabled: loaded.isControlButtonEnabled,
|
|
||||||
));
|
|
||||||
} else if (state is DeviceManagementFiltered) {
|
|
||||||
// final filtered = state as DeviceManagementFiltered;
|
|
||||||
// emit(DeviceManagementFiltered(
|
|
||||||
// filteredDevices: _filteredDevices,
|
|
||||||
// selectedIndex: filtered.selectedIndex,
|
|
||||||
// onlineCount: filtered.onlineCount,
|
|
||||||
// offlineCount: filtered.offlineCount,
|
|
||||||
// lowBatteryCount: filtered.lowBatteryCount,
|
|
||||||
// selectedDevice: filtered.selectedDevice,
|
|
||||||
// isControlButtonEnabled: filtered.isControlButtonEnabled,
|
|
||||||
// ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void changeSubspaceName(
|
|
||||||
String deviceId, String newSubSpaceName, String subspaceId) {
|
|
||||||
add(UpdateSubSpaceName(
|
|
||||||
deviceId: deviceId,
|
|
||||||
newSubSpaceName: newSubSpaceName,
|
|
||||||
subspaceId: subspaceId,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<AllDevicesModel> get selectedDevices => _selectedDevices;
|
List<AllDevicesModel> get selectedDevices => _selectedDevices;
|
||||||
}
|
}
|
||||||
|
|||||||
-18
@@ -70,21 +70,3 @@ class UpdateSelection extends DeviceManagementEvent {
|
|||||||
|
|
||||||
const UpdateSelection(this.selectedRows);
|
const UpdateSelection(this.selectedRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateDeviceName extends DeviceManagementEvent {
|
|
||||||
final String deviceId;
|
|
||||||
final String newName;
|
|
||||||
|
|
||||||
const UpdateDeviceName({required this.deviceId, required this.newName});
|
|
||||||
}
|
|
||||||
|
|
||||||
class UpdateSubSpaceName extends DeviceManagementEvent {
|
|
||||||
final String deviceId;
|
|
||||||
final String newSubSpaceName;
|
|
||||||
final String subspaceId;
|
|
||||||
|
|
||||||
const UpdateSubSpaceName(
|
|
||||||
{required this.deviceId,
|
|
||||||
required this.newSubSpaceName,
|
|
||||||
required this.subspaceId});
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -57,16 +57,6 @@ class Status {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Status copyWith({
|
|
||||||
String? code,
|
|
||||||
dynamic value,
|
|
||||||
}) {
|
|
||||||
return Status(
|
|
||||||
code: code ?? this.code,
|
|
||||||
value: value ?? this.value,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory Status.fromJson(String source) => Status.fromMap(json.decode(source));
|
factory Status.fromJson(String source) => Status.fromMap(json.decode(source));
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
String toJson() => json.encode(toMap());
|
||||||
|
|||||||
@@ -44,20 +44,4 @@ class DeviceSubspace {
|
|||||||
static List<Map<String, dynamic>> listToJson(List<DeviceSubspace> subspaces) {
|
static List<Map<String, dynamic>> listToJson(List<DeviceSubspace> subspaces) {
|
||||||
return subspaces.map((subspace) => subspace.toJson()).toList();
|
return subspaces.map((subspace) => subspace.toJson()).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceSubspace copyWith({
|
|
||||||
String? uuid,
|
|
||||||
DateTime? createdAt,
|
|
||||||
DateTime? updatedAt,
|
|
||||||
String? subspaceName,
|
|
||||||
bool? disabled,
|
|
||||||
}) {
|
|
||||||
return DeviceSubspace(
|
|
||||||
uuid: uuid ?? this.uuid,
|
|
||||||
createdAt: createdAt ?? this.createdAt,
|
|
||||||
updatedAt: updatedAt ?? this.updatedAt,
|
|
||||||
subspaceName: subspaceName ?? this.subspaceName,
|
|
||||||
disabled: disabled ?? this.disabled,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -588,72 +588,4 @@ SOS
|
|||||||
"NCPS": DeviceType.NCPS,
|
"NCPS": DeviceType.NCPS,
|
||||||
"PC": DeviceType.PC,
|
"PC": DeviceType.PC,
|
||||||
};
|
};
|
||||||
|
|
||||||
AllDevicesModel copyWith({
|
|
||||||
DevicesModelRoom? room,
|
|
||||||
DeviceSubspace? subspace,
|
|
||||||
DevicesModelUnit? unit,
|
|
||||||
DeviceCommunityModel? community,
|
|
||||||
String? productUuid,
|
|
||||||
String? productType,
|
|
||||||
String? permissionType,
|
|
||||||
int? activeTime,
|
|
||||||
String? category,
|
|
||||||
String? categoryName,
|
|
||||||
int? createTime,
|
|
||||||
String? gatewayId,
|
|
||||||
String? icon,
|
|
||||||
String? ip,
|
|
||||||
String? lat,
|
|
||||||
String? localKey,
|
|
||||||
String? lon,
|
|
||||||
String? model,
|
|
||||||
String? name,
|
|
||||||
String? nodeId,
|
|
||||||
bool? online,
|
|
||||||
String? ownerId,
|
|
||||||
bool? sub,
|
|
||||||
String? timeZone,
|
|
||||||
int? updateTime,
|
|
||||||
String? uuid,
|
|
||||||
int? batteryLevel,
|
|
||||||
String? productName,
|
|
||||||
List<DeviceSpaceModel>? spaces,
|
|
||||||
List<DeviceTagModel>? deviceTags,
|
|
||||||
DeviceSubSpace? deviceSubSpace,
|
|
||||||
}) {
|
|
||||||
return AllDevicesModel(
|
|
||||||
room: room ?? this.room,
|
|
||||||
subspace: subspace ?? this.subspace,
|
|
||||||
unit: unit ?? this.unit,
|
|
||||||
community: community ?? this.community,
|
|
||||||
productUuid: productUuid ?? this.productUuid,
|
|
||||||
productType: productType ?? this.productType,
|
|
||||||
permissionType: permissionType ?? this.permissionType,
|
|
||||||
activeTime: activeTime ?? this.activeTime,
|
|
||||||
category: category ?? this.category,
|
|
||||||
categoryName: categoryName ?? this.categoryName,
|
|
||||||
createTime: createTime ?? this.createTime,
|
|
||||||
gatewayId: gatewayId ?? this.gatewayId,
|
|
||||||
icon: icon ?? this.icon,
|
|
||||||
ip: ip ?? this.ip,
|
|
||||||
lat: lat ?? this.lat,
|
|
||||||
localKey: localKey ?? this.localKey,
|
|
||||||
lon: lon ?? this.lon,
|
|
||||||
model: model ?? this.model,
|
|
||||||
name: name ?? this.name,
|
|
||||||
nodeId: nodeId ?? this.nodeId,
|
|
||||||
online: online ?? this.online,
|
|
||||||
ownerId: ownerId ?? this.ownerId,
|
|
||||||
sub: sub ?? this.sub,
|
|
||||||
timeZone: timeZone ?? this.timeZone,
|
|
||||||
updateTime: updateTime ?? this.updateTime,
|
|
||||||
uuid: uuid ?? this.uuid,
|
|
||||||
batteryLevel: batteryLevel ?? this.batteryLevel,
|
|
||||||
productName: productName ?? this.productName,
|
|
||||||
spaces: spaces ?? this.spaces,
|
|
||||||
deviceTags: deviceTags ?? this.deviceTags,
|
|
||||||
deviceSubSpace: deviceSubSpace ?? this.deviceSubSpace,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<DeviceManagementBloc, DeviceManagementState>(
|
return BlocBuilder<DeviceManagementBloc, DeviceManagementState>(
|
||||||
buildWhen: (previous, current) => previous != current,
|
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
List<AllDevicesModel> devicesToShow = [];
|
List<AllDevicesModel> devicesToShow = [];
|
||||||
int selectedIndex = 0;
|
int selectedIndex = 0;
|
||||||
@@ -32,6 +31,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
int lowBatteryCount = 0;
|
int lowBatteryCount = 0;
|
||||||
bool isControlButtonEnabled = false;
|
bool isControlButtonEnabled = false;
|
||||||
List<AllDevicesModel> selectedDevices = [];
|
List<AllDevicesModel> selectedDevices = [];
|
||||||
|
|
||||||
if (state is DeviceManagementLoaded) {
|
if (state is DeviceManagementLoaded) {
|
||||||
devicesToShow = state.devices;
|
devicesToShow = state.devices;
|
||||||
selectedIndex = state.selectedIndex;
|
selectedIndex = state.selectedIndex;
|
||||||
@@ -111,8 +111,6 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
onPressed: isControlButtonEnabled
|
onPressed: isControlButtonEnabled
|
||||||
? () {
|
? () {
|
||||||
if (isAnyDeviceOffline) {
|
if (isAnyDeviceOffline) {
|
||||||
ScaffoldMessenger.of(context)
|
|
||||||
.clearSnackBars();
|
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context)
|
||||||
.showSnackBar(
|
.showSnackBar(
|
||||||
const SnackBar(
|
const SnackBar(
|
||||||
@@ -192,7 +190,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
'Product Name',
|
'Product Name',
|
||||||
'Device ID',
|
'Device ID',
|
||||||
'Space Name',
|
'Space Name',
|
||||||
'Location',
|
'location',
|
||||||
'Battery Level',
|
'Battery Level',
|
||||||
'Installation Date and Time',
|
'Installation Date and Time',
|
||||||
'Status',
|
'Status',
|
||||||
@@ -244,7 +242,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
.map((device) => device.uuid!)
|
.map((device) => device.uuid!)
|
||||||
.toList(),
|
.toList(),
|
||||||
isEmpty: devicesToShow.isEmpty,
|
isEmpty: devicesToShow.isEmpty,
|
||||||
onSettingsPressed: (rowIndex) async {
|
onSettingsPressed: (rowIndex) {
|
||||||
final device = devicesToShow[rowIndex];
|
final device = devicesToShow[rowIndex];
|
||||||
showDeviceSettingsSidebar(context, device);
|
showDeviceSettingsSidebar(context, device);
|
||||||
},
|
},
|
||||||
@@ -266,7 +264,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
barrierLabel: "Device Settings",
|
barrierLabel: "Device Settings",
|
||||||
transitionDuration: const Duration(milliseconds: 300),
|
transitionDuration: const Duration(milliseconds: 300),
|
||||||
pageBuilder: (_, anim1, anim2) {
|
pageBuilder: (context, anim1, anim2) {
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Material(
|
child: Material(
|
||||||
@@ -276,7 +274,6 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
child: DeviceSettingsPanel(
|
child: DeviceSettingsPanel(
|
||||||
device: device,
|
device: device,
|
||||||
onClose: () => Navigator.of(context).pop(),
|
onClose: () => Navigator.of(context).pop(),
|
||||||
deviceManagementBloc: context.read<DeviceManagementBloc>(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class CalibrateCompletedDialog extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(_) {
|
Widget build(_) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
|
backgroundColor: ColorsManager.whiteColors,
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: 250,
|
height: 250,
|
||||||
|
|||||||
@@ -19,14 +19,11 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
required this.device,
|
required this.device,
|
||||||
required this.subSpaces,
|
required this.subSpaces,
|
||||||
required this.deviceInfo,
|
required this.deviceInfo,
|
||||||
required this.deviceManagementBloc,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final AllDevicesModel device;
|
final AllDevicesModel device;
|
||||||
final List<SubSpaceModel> subSpaces;
|
final List<SubSpaceModel> subSpaces;
|
||||||
final DeviceInfoModel deviceInfo;
|
final DeviceInfoModel deviceInfo;
|
||||||
final DeviceManagementBloc deviceManagementBloc;
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -90,11 +87,6 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
deviceManagementBloc.add(UpdateSubSpaceName(
|
|
||||||
subspaceId: selectedSubSpace.id!,
|
|
||||||
deviceId: device.uuid!,
|
|
||||||
newSubSpaceName: selectedSubSpace.name ?? ''));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: infoRow(
|
child: infoRow(
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/bloc/setting_bloc_bloc.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/bloc/setting_bloc_state.dart';
|
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/device_icon_type_helper.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/device_icon_type_helper.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/device_management_content.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/device_management_content.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/remove_device_widget.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/remove_device_widget.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/device_setting/bloc/setting_bloc_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/device_setting/bloc/setting_bloc_state.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
@@ -19,13 +17,7 @@ import 'package:syncrow_web/web_layout/default_container.dart';
|
|||||||
class DeviceSettingsPanel extends StatelessWidget {
|
class DeviceSettingsPanel extends StatelessWidget {
|
||||||
final VoidCallback? onClose;
|
final VoidCallback? onClose;
|
||||||
final AllDevicesModel device;
|
final AllDevicesModel device;
|
||||||
final DeviceManagementBloc deviceManagementBloc;
|
const DeviceSettingsPanel({super.key, this.onClose, required this.device});
|
||||||
const DeviceSettingsPanel({
|
|
||||||
super.key,
|
|
||||||
this.onClose,
|
|
||||||
required this.device,
|
|
||||||
required this.deviceManagementBloc,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -79,10 +71,10 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
'Device Settings',
|
'Device Settings',
|
||||||
style: context.theme.textTheme.titleLarge!
|
style: context.theme.textTheme.titleLarge!
|
||||||
.copyWith(
|
.copyWith(
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: ColorsManager.vividBlue
|
color: ColorsManager.vividBlue
|
||||||
.withOpacity(0.7),
|
.withOpacity(0.7),
|
||||||
fontSize: 24),
|
fontSize: 24),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -142,14 +134,8 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
onFieldSubmitted: (value) {
|
onFieldSubmitted: (value) {
|
||||||
_bloc.add(const ChangeNameEvent(
|
_bloc.add(const ChangeNameEvent(
|
||||||
value: false));
|
value: false));
|
||||||
deviceManagementBloc
|
|
||||||
..add(UpdateDeviceName(
|
|
||||||
deviceId: device.uuid!,
|
|
||||||
newName: _bloc
|
|
||||||
.nameController
|
|
||||||
.text))..add(ResetSelectedDevices());
|
|
||||||
},
|
},
|
||||||
decoration:const InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
@@ -171,7 +157,7 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
_bloc.add(
|
_bloc.add(
|
||||||
const ChangeNameEvent(
|
const ChangeNameEvent(
|
||||||
value: true));
|
value: true));
|
||||||
},
|
},
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets
|
Assets
|
||||||
@@ -204,7 +190,6 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
device: device,
|
device: device,
|
||||||
subSpaces: subSpaces.cast<SubSpaceModel>(),
|
subSpaces: subSpaces.cast<SubSpaceModel>(),
|
||||||
deviceInfo: deviceInfo,
|
deviceInfo: deviceInfo,
|
||||||
deviceManagementBloc: deviceManagementBloc,
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
RemoveDeviceWidget(bloc: _bloc),
|
RemoveDeviceWidget(bloc: _bloc),
|
||||||
|
|||||||
@@ -286,20 +286,11 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
|
|||||||
try {
|
try {
|
||||||
if (state is ScheduleLoaded) {
|
if (state is ScheduleLoaded) {
|
||||||
final dateTime = DateTime.parse(event.time);
|
final dateTime = DateTime.parse(event.time);
|
||||||
Status status = Status(code: '', value: '');
|
|
||||||
if (event.category == 'CUR_2') {
|
|
||||||
status = status.copyWith(
|
|
||||||
code: 'control',
|
|
||||||
value: event.functionOn == true ? 'open' : 'close');
|
|
||||||
} else {
|
|
||||||
status =
|
|
||||||
status.copyWith(code: event.category, value: event.functionOn);
|
|
||||||
}
|
|
||||||
final updatedSchedule = ScheduleEntry(
|
final updatedSchedule = ScheduleEntry(
|
||||||
scheduleId: event.scheduleId,
|
scheduleId: event.scheduleId,
|
||||||
category: event.category,
|
category: event.category,
|
||||||
time: getTimeStampWithoutSeconds(dateTime).toString(),
|
time: getTimeStampWithoutSeconds(dateTime).toString(),
|
||||||
function: status,
|
function: Status(code: event.category, value: event.functionOn),
|
||||||
days: event.selectedDays,
|
days: event.selectedDays,
|
||||||
);
|
);
|
||||||
final success = await DevicesManagementApi().editScheduleRecord(
|
final success = await DevicesManagementApi().editScheduleRecord(
|
||||||
|
|||||||
@@ -52,12 +52,9 @@ class BuildScheduleView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
const ScheduleHeader(),
|
const ScheduleHeader(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
if (category == 'CUR_2')
|
ScheduleModeSelector(
|
||||||
const SizedBox()
|
currentMode: state.scheduleMode,
|
||||||
else
|
),
|
||||||
ScheduleModeSelector(
|
|
||||||
currentMode: state.scheduleMode,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
if (state.scheduleMode == ScheduleModes.schedule)
|
if (state.scheduleMode == ScheduleModes.schedule)
|
||||||
ScheduleManagementUI(
|
ScheduleManagementUI(
|
||||||
|
|||||||
@@ -195,10 +195,10 @@ class _ScheduleTableView extends StatelessWidget {
|
|||||||
child: Text(_getSelectedDays(
|
child: Text(_getSelectedDays(
|
||||||
ScheduleModel.parseSelectedDays(schedule.days)))),
|
ScheduleModel.parseSelectedDays(schedule.days)))),
|
||||||
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
||||||
if (schedule.category == 'CUR_2')
|
schedule.category == 'CUR_2'
|
||||||
Center(child: Text(schedule.function.value))
|
? Center(
|
||||||
else
|
child: Text(schedule.function.value == true ? 'open' : 'close'))
|
||||||
Center(child: Text(schedule.function.value ? 'On' : 'Off')),
|
: Center(child: Text(schedule.function.value ? 'On' : 'Off')),
|
||||||
Center(
|
Center(
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
runAlignment: WrapAlignment.center,
|
runAlignment: WrapAlignment.center,
|
||||||
@@ -212,20 +212,12 @@ class _ScheduleTableView extends StatelessWidget {
|
|||||||
isEdit: true,
|
isEdit: true,
|
||||||
).then((updatedSchedule) {
|
).then((updatedSchedule) {
|
||||||
if (updatedSchedule != null) {
|
if (updatedSchedule != null) {
|
||||||
bool temp;
|
|
||||||
if (schedule.category == 'CUR_2') {
|
|
||||||
updatedSchedule.function.value == 'open'
|
|
||||||
? temp = true
|
|
||||||
: temp = false;
|
|
||||||
} else {
|
|
||||||
temp = updatedSchedule.function.value;
|
|
||||||
}
|
|
||||||
context.read<ScheduleBloc>().add(
|
context.read<ScheduleBloc>().add(
|
||||||
ScheduleEditEvent(
|
ScheduleEditEvent(
|
||||||
scheduleId: schedule.scheduleId,
|
scheduleId: schedule.scheduleId,
|
||||||
category: schedule.category,
|
category: schedule.category,
|
||||||
time: updatedSchedule.time,
|
time: updatedSchedule.time,
|
||||||
functionOn: temp,
|
functionOn: updatedSchedule.function.value,
|
||||||
selectedDays: updatedSchedule.days),
|
selectedDays: updatedSchedule.days),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,19 +19,13 @@ class ScheduleDialogHelper {
|
|||||||
bool isEdit = false,
|
bool isEdit = false,
|
||||||
String? code,
|
String? code,
|
||||||
}) {
|
}) {
|
||||||
bool temp;
|
|
||||||
if (schedule?.category == 'CUR_2') {
|
|
||||||
temp = schedule!.function.value == 'open' ? true : false;
|
|
||||||
} else {
|
|
||||||
temp = schedule!.function.value;
|
|
||||||
}
|
|
||||||
final initialTime = schedule != null
|
final initialTime = schedule != null
|
||||||
? _convertStringToTimeOfDay(schedule.time)
|
? _convertStringToTimeOfDay(schedule.time)
|
||||||
: TimeOfDay.now();
|
: TimeOfDay.now();
|
||||||
final initialDays = schedule != null
|
final initialDays = schedule != null
|
||||||
? _convertDaysStringToBooleans(schedule.days)
|
? _convertDaysStringToBooleans(schedule.days)
|
||||||
: List.filled(7, false);
|
: List.filled(7, false);
|
||||||
bool? functionOn = temp;
|
bool? functionOn = schedule?.function.value ?? true;
|
||||||
TimeOfDay selectedTime = initialTime;
|
TimeOfDay selectedTime = initialTime;
|
||||||
List<bool> selectedDays = List.of(initialDays);
|
List<bool> selectedDays = List.of(initialDays);
|
||||||
|
|
||||||
|
|||||||
@@ -170,45 +170,45 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onLoadScenes(
|
Future<void> _onLoadScenes(
|
||||||
LoadScenes event, Emitter<RoutineState> emit) async {
|
LoadScenes event, Emitter<RoutineState> emit) async {
|
||||||
emit(state.copyWith(isLoading: true, errorMessage: null));
|
emit(state.copyWith(isLoading: true, errorMessage: null));
|
||||||
List<ScenesModel> scenes = [];
|
List<ScenesModel> scenes = [];
|
||||||
try {
|
try {
|
||||||
BuildContext context = NavigationService.navigatorKey.currentContext!;
|
BuildContext context = NavigationService.navigatorKey.currentContext!;
|
||||||
var createRoutineBloc = context.read<CreateRoutineBloc>();
|
var createRoutineBloc = context.read<CreateRoutineBloc>();
|
||||||
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
|
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
|
||||||
if (createRoutineBloc.selectedSpaceId == '' &&
|
if (createRoutineBloc.selectedSpaceId == '' &&
|
||||||
createRoutineBloc.selectedCommunityId == '') {
|
createRoutineBloc.selectedCommunityId == '') {
|
||||||
var spaceBloc = context.read<SpaceTreeBloc>();
|
var spaceBloc = context.read<SpaceTreeBloc>();
|
||||||
for (var communityId in spaceBloc.state.selectedCommunities) {
|
for (var communityId in spaceBloc.state.selectedCommunities) {
|
||||||
List<String> spacesList =
|
List<String> spacesList =
|
||||||
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
|
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
|
||||||
for (var spaceId in spacesList) {
|
for (var spaceId in spacesList) {
|
||||||
scenes.addAll(
|
scenes.addAll(
|
||||||
await SceneApi.getScenes(spaceId, communityId, projectUuid));
|
await SceneApi.getScenes(spaceId, communityId, projectUuid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
scenes.addAll(await SceneApi.getScenes(
|
||||||
|
createRoutineBloc.selectedSpaceId,
|
||||||
|
createRoutineBloc.selectedCommunityId,
|
||||||
|
projectUuid));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
scenes.addAll(await SceneApi.getScenes(
|
|
||||||
createRoutineBloc.selectedSpaceId,
|
|
||||||
createRoutineBloc.selectedCommunityId,
|
|
||||||
projectUuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
scenes: scenes,
|
scenes: scenes,
|
||||||
isLoading: false,
|
|
||||||
));
|
|
||||||
} catch (e) {
|
|
||||||
emit(state.copyWith(
|
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
loadScenesErrorMessage: 'Failed to load scenes',
|
));
|
||||||
errorMessage: '',
|
} catch (e) {
|
||||||
loadAutomationErrorMessage: '',
|
emit(state.copyWith(
|
||||||
scenes: scenes));
|
isLoading: false,
|
||||||
|
loadScenesErrorMessage: 'Failed to load scenes',
|
||||||
|
errorMessage: '',
|
||||||
|
loadAutomationErrorMessage: '',
|
||||||
|
scenes: scenes));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onLoadAutomation(
|
Future<void> _onLoadAutomation(
|
||||||
LoadAutomation event, Emitter<RoutineState> emit) async {
|
LoadAutomation event, Emitter<RoutineState> emit) async {
|
||||||
@@ -936,16 +936,12 @@ Future<void> _onLoadScenes(
|
|||||||
for (var communityId in spaceBloc.state.selectedCommunities) {
|
for (var communityId in spaceBloc.state.selectedCommunities) {
|
||||||
List<String> spacesList =
|
List<String> spacesList =
|
||||||
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
|
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
|
||||||
for (var spaceId in spacesList) {
|
devices.addAll(await DevicesManagementApi()
|
||||||
devices.addAll(await DevicesManagementApi()
|
.fetchDevices(projectUuid, spacesId: spacesList));
|
||||||
.fetchDevices(communityId, spaceId, projectUuid));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
devices.addAll(await DevicesManagementApi().fetchDevices(
|
devices.addAll(await DevicesManagementApi().fetchDevices(projectUuid,
|
||||||
createRoutineBloc.selectedCommunityId,
|
spacesId: [createRoutineBloc.selectedSpaceId]));
|
||||||
createRoutineBloc.selectedSpaceId,
|
|
||||||
projectUuid));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(state.copyWith(isLoading: false, devices: devices));
|
emit(state.copyWith(isLoading: false, devices: devices));
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ class CurtainHelper {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
DialogHeader(dialogType == 'THEN'
|
const DialogHeader('AC Functions'),
|
||||||
? 'Curtain Functions'
|
|
||||||
: 'Curtain Conditions'),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
|||||||
@@ -58,14 +58,11 @@ class ProductModel {
|
|||||||
'3G': Assets.Gang3SwitchIcon,
|
'3G': Assets.Gang3SwitchIcon,
|
||||||
'3GT': Assets.threeTouchSwitch,
|
'3GT': Assets.threeTouchSwitch,
|
||||||
'CUR': Assets.curtain,
|
'CUR': Assets.curtain,
|
||||||
'CUR_2': Assets.curtain,
|
|
||||||
'GD': Assets.garageDoor,
|
'GD': Assets.garageDoor,
|
||||||
'GW': Assets.SmartGatewayIcon,
|
'GW': Assets.SmartGatewayIcon,
|
||||||
'DL': Assets.DoorLockIcon,
|
'DL': Assets.DoorLockIcon,
|
||||||
'WL': Assets.waterLeakSensor,
|
'WL': Assets.waterLeakSensor,
|
||||||
'WH': Assets.waterHeater,
|
'WH': Assets.waterHeater,
|
||||||
'WM': Assets.waterLeakSensor,
|
|
||||||
'SOS': Assets.sos,
|
|
||||||
'AC': Assets.ac,
|
'AC': Assets.ac,
|
||||||
'CPS': Assets.presenceSensor,
|
'CPS': Assets.presenceSensor,
|
||||||
'PC': Assets.powerClamp,
|
'PC': Assets.powerClamp,
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
|
||||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||||
import 'package:syncrow_web/pages/common/date_time_widget.dart';
|
import 'package:syncrow_web/pages/common/date_time_widget.dart';
|
||||||
|
import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart';
|
||||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.dart';
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.dart';
|
||||||
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_state.dart';
|
import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_state.dart';
|
||||||
@@ -21,8 +23,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
final text = Theme.of(context)
|
var text = Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.bodySmall!
|
.bodySmall!
|
||||||
.copyWith(color: Colors.black, fontSize: 13);
|
.copyWith(color: Colors.black, fontSize: 13);
|
||||||
@@ -39,7 +41,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
title: 'Sent Successfully',
|
title: 'Sent Successfully',
|
||||||
widgeta: Column(
|
widgeta: Column(
|
||||||
children: [
|
children: [
|
||||||
if (visitorBloc.passwordStatus!.failedOperations.isNotEmpty)
|
if (visitorBloc
|
||||||
|
.passwordStatus!.failedOperations.isNotEmpty)
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
const Text('Failed Devices'),
|
const Text('Failed Devices'),
|
||||||
@@ -53,19 +56,22 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
.passwordStatus!.failedOperations.length,
|
.passwordStatus!.failedOperations.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.all(5),
|
margin: EdgeInsets.all(5),
|
||||||
decoration: containerDecoration,
|
decoration: containerDecoration,
|
||||||
height: 45,
|
height: 45,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(visitorBloc.passwordStatus!
|
child: Text(visitorBloc
|
||||||
.failedOperations[index].deviceName)),
|
.passwordStatus!
|
||||||
|
.failedOperations[index]
|
||||||
|
.deviceName)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (visitorBloc.passwordStatus!.successOperations.isNotEmpty)
|
if (visitorBloc
|
||||||
|
.passwordStatus!.successOperations.isNotEmpty)
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
const Text('Success Devices'),
|
const Text('Success Devices'),
|
||||||
@@ -79,12 +85,14 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
.passwordStatus!.successOperations.length,
|
.passwordStatus!.successOperations.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.all(5),
|
margin: EdgeInsets.all(5),
|
||||||
decoration: containerDecoration,
|
decoration: containerDecoration,
|
||||||
height: 45,
|
height: 45,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(visitorBloc.passwordStatus!
|
child: Text(visitorBloc
|
||||||
.successOperations[index].deviceName)),
|
.passwordStatus!
|
||||||
|
.successOperations[index]
|
||||||
|
.deviceName)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -107,14 +115,16 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
child: BlocBuilder<VisitorPasswordBloc, VisitorPasswordState>(
|
child: BlocBuilder<VisitorPasswordBloc, VisitorPasswordState>(
|
||||||
builder: (BuildContext context, VisitorPasswordState state) {
|
builder: (BuildContext context, VisitorPasswordState state) {
|
||||||
final visitorBloc = BlocProvider.of<VisitorPasswordBloc>(context);
|
final visitorBloc = BlocProvider.of<VisitorPasswordBloc>(context);
|
||||||
final isRepeat =
|
bool isRepeat =
|
||||||
state is IsRepeatState ? state.repeat : visitorBloc.repeat;
|
state is IsRepeatState ? state.repeat : visitorBloc.repeat;
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
title: Text(
|
title: Text(
|
||||||
'Create visitor password',
|
'Create visitor password',
|
||||||
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
|
style: Theme.of(context).textTheme.headlineLarge!.copyWith(
|
||||||
fontWeight: FontWeight.w400, fontSize: 24, color: Colors.black),
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 24,
|
||||||
|
color: Colors.black),
|
||||||
),
|
),
|
||||||
content: state is LoadingInitialState
|
content: state is LoadingInitialState
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
@@ -300,12 +310,14 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password') {
|
'Offline Password') {
|
||||||
visitorBloc.add(SelectTimeEvent(
|
visitorBloc.add(SelectTimeEvent(
|
||||||
context: context, isEffective: false));
|
|
||||||
} else {
|
|
||||||
visitorBloc.add(SelectTimeVisitorPassword(
|
|
||||||
context: context,
|
context: context,
|
||||||
isStart: false,
|
isEffective: false));
|
||||||
isRepeat: false));
|
} else {
|
||||||
|
visitorBloc.add(
|
||||||
|
SelectTimeVisitorPassword(
|
||||||
|
context: context,
|
||||||
|
isStart: false,
|
||||||
|
isRepeat: false));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startTime: () {
|
startTime: () {
|
||||||
@@ -314,28 +326,31 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password') {
|
'Offline Password') {
|
||||||
visitorBloc.add(SelectTimeEvent(
|
visitorBloc.add(SelectTimeEvent(
|
||||||
context: context, isEffective: true));
|
|
||||||
} else {
|
|
||||||
visitorBloc.add(SelectTimeVisitorPassword(
|
|
||||||
context: context,
|
context: context,
|
||||||
isStart: true,
|
isEffective: true));
|
||||||
isRepeat: false));
|
} else {
|
||||||
|
visitorBloc.add(
|
||||||
|
SelectTimeVisitorPassword(
|
||||||
|
context: context,
|
||||||
|
isStart: true,
|
||||||
|
isRepeat: false));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
firstString:
|
firstString: (visitorBloc
|
||||||
(visitorBloc.usageFrequencySelected ==
|
.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password')
|
'Offline Password')
|
||||||
? visitorBloc.effectiveTime
|
? visitorBloc.effectiveTime
|
||||||
: visitorBloc.startTimeAccess,
|
: visitorBloc.startTimeAccess
|
||||||
|
.toString(),
|
||||||
secondString: (visitorBloc
|
secondString: (visitorBloc
|
||||||
.usageFrequencySelected ==
|
.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected ==
|
visitorBloc.accessTypeSelected ==
|
||||||
'Offline Password')
|
'Offline Password')
|
||||||
? visitorBloc.expirationTime
|
? visitorBloc.expirationTime
|
||||||
: visitorBloc.endTimeAccess,
|
: visitorBloc.endTimeAccess.toString(),
|
||||||
icon: Assets.calendarIcon),
|
icon: Assets.calendarIcon),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
@@ -395,7 +410,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
child: CupertinoSwitch(
|
child: CupertinoSwitch(
|
||||||
value: visitorBloc.repeat,
|
value: visitorBloc.repeat,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
visitorBloc.add(ToggleRepeatEvent());
|
visitorBloc
|
||||||
|
.add(ToggleRepeatEvent());
|
||||||
},
|
},
|
||||||
applyTheme: true,
|
applyTheme: true,
|
||||||
),
|
),
|
||||||
@@ -426,7 +442,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
).then((listDevice) {
|
).then((listDevice) {
|
||||||
if (listDevice != null) {
|
if (listDevice != null) {
|
||||||
visitorBloc.selectedDevices = listDevice;
|
visitorBloc.selectedDevices =
|
||||||
|
listDevice;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -438,7 +455,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
.bodySmall!
|
.bodySmall!
|
||||||
.copyWith(
|
.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: ColorsManager.whiteColors,
|
color:
|
||||||
|
ColorsManager.whiteColors,
|
||||||
fontSize: 12),
|
fontSize: 12),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -477,30 +495,37 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (visitorBloc.forgetFormKey.currentState!.validate()) {
|
if (visitorBloc.forgetFormKey.currentState!.validate()) {
|
||||||
if (visitorBloc.selectedDevices.isNotEmpty) {
|
if (visitorBloc.selectedDevices.isNotEmpty) {
|
||||||
if (visitorBloc.usageFrequencySelected == 'One-Time' &&
|
if (visitorBloc.usageFrequencySelected ==
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
'One-Time' &&
|
||||||
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
setPasswordFunction(context, size, visitorBloc);
|
setPasswordFunction(context, size, visitorBloc);
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
if (visitorBloc.expirationTime != 'End Time' &&
|
if (visitorBloc.expirationTime != 'End Time' &&
|
||||||
visitorBloc.effectiveTime != 'Start Time') {
|
visitorBloc.effectiveTime != 'Start Time') {
|
||||||
setPasswordFunction(context, size, visitorBloc);
|
setPasswordFunction(context, size, visitorBloc);
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Please select Access Period to continue',
|
message:
|
||||||
|
'Please select Access Period to continue',
|
||||||
title: 'Access Period');
|
title: 'Access Period');
|
||||||
}
|
}
|
||||||
} else if (visitorBloc.endTimeAccess != 'End Time' &&
|
} else if (visitorBloc.endTimeAccess.toString() !=
|
||||||
visitorBloc.startTimeAccess != 'Start Time') {
|
'End Time' &&
|
||||||
|
visitorBloc.startTimeAccess.toString() !=
|
||||||
|
'Start Time') {
|
||||||
if (visitorBloc.effectiveTimeTimeStamp != null &&
|
if (visitorBloc.effectiveTimeTimeStamp != null &&
|
||||||
visitorBloc.expirationTimeTimeStamp != null) {
|
visitorBloc.expirationTimeTimeStamp != null) {
|
||||||
if (isRepeat == true) {
|
if (isRepeat == true) {
|
||||||
if (visitorBloc.expirationTime != 'End Time' &&
|
if (visitorBloc.expirationTime != 'End Time' &&
|
||||||
visitorBloc.effectiveTime != 'Start Time' &&
|
visitorBloc.effectiveTime != 'Start Time' &&
|
||||||
visitorBloc.selectedDays.isNotEmpty) {
|
visitorBloc.selectedDays.isNotEmpty) {
|
||||||
setPasswordFunction(context, size, visitorBloc);
|
setPasswordFunction(
|
||||||
|
context, size, visitorBloc);
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -514,13 +539,15 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Please select Access Period to continue',
|
message:
|
||||||
|
'Please select Access Period to continue',
|
||||||
title: 'Access Period');
|
title: 'Access Period');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
visitorBloc.stateDialog(
|
visitorBloc.stateDialog(
|
||||||
context: context,
|
context: context,
|
||||||
message: 'Please select Access Period to continue',
|
message:
|
||||||
|
'Please select Access Period to continue',
|
||||||
title: 'Access Period');
|
title: 'Access Period');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -566,17 +593,17 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: size.height * 0.25,
|
height: size.height * 0.25,
|
||||||
child: const Center(
|
child: Center(
|
||||||
child: CircularProgressIndicator(), // Display a loading spinner
|
child:
|
||||||
|
CircularProgressIndicator(), // Display a loading spinner
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
backgroundColor: Colors.white,
|
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: size.height * 0.13,
|
height: size.height * 0.25,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
@@ -590,16 +617,13 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
width: 35,
|
width: 35,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
'Set Password',
|
'Set Password',
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.headlineLarge!
|
.headlineLarge!
|
||||||
.copyWith(
|
.copyWith(
|
||||||
fontSize: 24,
|
fontSize: 30,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
@@ -607,6 +631,15 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 15),
|
||||||
|
Text(
|
||||||
|
'This action will update all of the selected\n door locks passwords in the property.\n\nAre you sure you want to continue?',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||||
|
color: ColorsManager.grayColor,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -635,12 +668,12 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
decoration: containerDecoration,
|
decoration: containerDecoration,
|
||||||
width: size.width * 0.1,
|
width: size.width * 0.1,
|
||||||
child: DefaultButton(
|
child: DefaultButton(
|
||||||
backgroundColor: Color(0xff023DFE),
|
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
if (visitorBloc.usageFrequencySelected == 'One-Time' &&
|
if (visitorBloc.usageFrequencySelected == 'One-Time' &&
|
||||||
visitorBloc.accessTypeSelected == 'Online Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Online Password') {
|
||||||
visitorBloc.add(OnlineOneTimePasswordEvent(
|
visitorBloc.add(OnlineOneTimePasswordEvent(
|
||||||
context: context,
|
context: context,
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
@@ -648,7 +681,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected == 'Online Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Online Password') {
|
||||||
visitorBloc.add(OnlineMultipleTimePasswordEvent(
|
visitorBloc.add(OnlineMultipleTimePasswordEvent(
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
email: visitorBloc.emailController.text,
|
email: visitorBloc.emailController.text,
|
||||||
@@ -659,7 +693,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'One-Time' &&
|
'One-Time' &&
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
visitorBloc.add(OfflineOneTimePasswordEvent(
|
visitorBloc.add(OfflineOneTimePasswordEvent(
|
||||||
context: context,
|
context: context,
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
@@ -667,7 +702,8 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
));
|
));
|
||||||
} else if (visitorBloc.usageFrequencySelected ==
|
} else if (visitorBloc.usageFrequencySelected ==
|
||||||
'Periodic' &&
|
'Periodic' &&
|
||||||
visitorBloc.accessTypeSelected == 'Offline Password') {
|
visitorBloc.accessTypeSelected ==
|
||||||
|
'Offline Password') {
|
||||||
visitorBloc.add(OfflineMultipleTimePasswordEvent(
|
visitorBloc.add(OfflineMultipleTimePasswordEvent(
|
||||||
passwordName: visitorBloc.userNameController.text,
|
passwordName: visitorBloc.userNameController.text,
|
||||||
email: visitorBloc.emailController.text,
|
email: visitorBloc.emailController.text,
|
||||||
@@ -679,7 +715,7 @@ class VisitorPasswordDialog extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Confirm',
|
'Ok',
|
||||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: ColorsManager.whiteColors,
|
color: ColorsManager.whiteColors,
|
||||||
|
|||||||
@@ -13,15 +13,13 @@ import 'package:syncrow_web/utils/constants/api_const.dart';
|
|||||||
|
|
||||||
class DevicesManagementApi {
|
class DevicesManagementApi {
|
||||||
Future<List<AllDevicesModel>> fetchDevices(
|
Future<List<AllDevicesModel>> fetchDevices(
|
||||||
String communityId, String spaceId, String projectId) async {
|
String projectId, {
|
||||||
|
List<String>? spacesId,
|
||||||
|
}) async {
|
||||||
try {
|
try {
|
||||||
final response = await HTTPService().get(
|
final response = await HTTPService().get(
|
||||||
path: communityId.isNotEmpty && spaceId.isNotEmpty
|
queryParameters: {if (spacesId != null) 'spaces': spacesId},
|
||||||
? ApiEndpoints.getSpaceDevices
|
path: ApiEndpoints.getAllDevices.replaceAll('{projectId}', projectId),
|
||||||
.replaceAll('{spaceUuid}', spaceId)
|
|
||||||
.replaceAll('{communityUuid}', communityId)
|
|
||||||
.replaceAll('{projectId}', projectId)
|
|
||||||
: ApiEndpoints.getAllDevices.replaceAll('{projectId}', projectId),
|
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
List<dynamic> jsonData = json['data'];
|
List<dynamic> jsonData = json['data'];
|
||||||
@@ -416,5 +414,4 @@ class DevicesManagementApi {
|
|||||||
);
|
);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ abstract class ApiEndpoints {
|
|||||||
|
|
||||||
static const String getAllDevices = '/projects/{projectId}/devices';
|
static const String getAllDevices = '/projects/{projectId}/devices';
|
||||||
static const String getSpaceDevices =
|
static const String getSpaceDevices =
|
||||||
'/projects/{projectId}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
|
'/projects/{projectId}/devices';
|
||||||
static const String getDeviceStatus = '/devices/{uuid}/functions/status';
|
static const String getDeviceStatus = '/devices/{uuid}/functions/status';
|
||||||
static const String getBatchStatus = '/devices/batch';
|
static const String getBatchStatus = '/devices/batch';
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class Assets {
|
|||||||
static const String rightLine = 'assets/images/right_line.png';
|
static const String rightLine = 'assets/images/right_line.png';
|
||||||
static const String google = 'assets/images/google.svg';
|
static const String google = 'assets/images/google.svg';
|
||||||
static const String facebook = 'assets/images/facebook.svg';
|
static const String facebook = 'assets/images/facebook.svg';
|
||||||
static const String invisiblePassword = 'assets/images/Password_invisible.svg';
|
static const String invisiblePassword =
|
||||||
|
'assets/images/Password_invisible.svg';
|
||||||
static const String visiblePassword = 'assets/images/password_visible.svg';
|
static const String visiblePassword = 'assets/images/password_visible.svg';
|
||||||
static const String accessIcon = 'assets/images/access_icon.svg';
|
static const String accessIcon = 'assets/images/access_icon.svg';
|
||||||
static const String spaseManagementIcon =
|
static const String spaseManagementIcon =
|
||||||
@@ -33,7 +34,8 @@ class Assets {
|
|||||||
static const String emptyTable = 'assets/images/empty_table.svg';
|
static const String emptyTable = 'assets/images/empty_table.svg';
|
||||||
|
|
||||||
// General assets
|
// General assets
|
||||||
static const String motionlessDetection = 'assets/icons/motionless_detection.svg';
|
static const String motionlessDetection =
|
||||||
|
'assets/icons/motionless_detection.svg';
|
||||||
static const String acHeating = 'assets/icons/ac_heating.svg';
|
static const String acHeating = 'assets/icons/ac_heating.svg';
|
||||||
static const String acPowerOff = 'assets/icons/ac_power_off.svg';
|
static const String acPowerOff = 'assets/icons/ac_power_off.svg';
|
||||||
static const String acFanMiddle = 'assets/icons/ac_fan_middle.svg';
|
static const String acFanMiddle = 'assets/icons/ac_fan_middle.svg';
|
||||||
@@ -70,19 +72,22 @@ class Assets {
|
|||||||
'assets/icons/automation_functions/temp_password_unlock.svg';
|
'assets/icons/automation_functions/temp_password_unlock.svg';
|
||||||
static const String doorlockNormalOpen =
|
static const String doorlockNormalOpen =
|
||||||
'assets/icons/automation_functions/doorlock_normal_open.svg';
|
'assets/icons/automation_functions/doorlock_normal_open.svg';
|
||||||
static const String doorbell = 'assets/icons/automation_functions/doorbell.svg';
|
static const String doorbell =
|
||||||
|
'assets/icons/automation_functions/doorbell.svg';
|
||||||
static const String remoteUnlockViaApp =
|
static const String remoteUnlockViaApp =
|
||||||
'assets/icons/automation_functions/remote_unlock_via_app.svg';
|
'assets/icons/automation_functions/remote_unlock_via_app.svg';
|
||||||
static const String doubleLock =
|
static const String doubleLock =
|
||||||
'assets/icons/automation_functions/double_lock.svg';
|
'assets/icons/automation_functions/double_lock.svg';
|
||||||
static const String selfTestResult =
|
static const String selfTestResult =
|
||||||
'assets/icons/automation_functions/self_test_result.svg';
|
'assets/icons/automation_functions/self_test_result.svg';
|
||||||
static const String lockAlarm = 'assets/icons/automation_functions/lock_alarm.svg';
|
static const String lockAlarm =
|
||||||
|
'assets/icons/automation_functions/lock_alarm.svg';
|
||||||
static const String presenceState =
|
static const String presenceState =
|
||||||
'assets/icons/automation_functions/presence_state.svg';
|
'assets/icons/automation_functions/presence_state.svg';
|
||||||
static const String currentTemp =
|
static const String currentTemp =
|
||||||
'assets/icons/automation_functions/current_temp.svg';
|
'assets/icons/automation_functions/current_temp.svg';
|
||||||
static const String presence = 'assets/icons/automation_functions/presence.svg';
|
static const String presence =
|
||||||
|
'assets/icons/automation_functions/presence.svg';
|
||||||
static const String residualElectricity =
|
static const String residualElectricity =
|
||||||
'assets/icons/automation_functions/residual_electricity.svg';
|
'assets/icons/automation_functions/residual_electricity.svg';
|
||||||
static const String hijackAlarm =
|
static const String hijackAlarm =
|
||||||
@@ -99,12 +104,15 @@ class Assets {
|
|||||||
|
|
||||||
// Presence Sensor Assets
|
// Presence Sensor Assets
|
||||||
static const String sensorMotionIcon = 'assets/icons/sensor_motion_ic.svg';
|
static const String sensorMotionIcon = 'assets/icons/sensor_motion_ic.svg';
|
||||||
static const String sensorPresenceIcon = 'assets/icons/sensor_presence_ic.svg';
|
static const String sensorPresenceIcon =
|
||||||
|
'assets/icons/sensor_presence_ic.svg';
|
||||||
static const String sensorVacantIcon = 'assets/icons/sensor_vacant_ic.svg';
|
static const String sensorVacantIcon = 'assets/icons/sensor_vacant_ic.svg';
|
||||||
static const String illuminanceRecordIcon =
|
static const String illuminanceRecordIcon =
|
||||||
'assets/icons/illuminance_record_ic.svg';
|
'assets/icons/illuminance_record_ic.svg';
|
||||||
static const String presenceRecordIcon = 'assets/icons/presence_record_ic.svg';
|
static const String presenceRecordIcon =
|
||||||
static const String helpDescriptionIcon = 'assets/icons/help_description_ic.svg';
|
'assets/icons/presence_record_ic.svg';
|
||||||
|
static const String helpDescriptionIcon =
|
||||||
|
'assets/icons/help_description_ic.svg';
|
||||||
|
|
||||||
static const String lightPulp = 'assets/icons/light_pulb.svg';
|
static const String lightPulp = 'assets/icons/light_pulb.svg';
|
||||||
static const String acDevice = 'assets/icons/ac_device.svg';
|
static const String acDevice = 'assets/icons/ac_device.svg';
|
||||||
@@ -158,10 +166,12 @@ class Assets {
|
|||||||
static const String unit = 'assets/icons/unit_icon.svg';
|
static const String unit = 'assets/icons/unit_icon.svg';
|
||||||
static const String villa = 'assets/icons/villa_icon.svg';
|
static const String villa = 'assets/icons/villa_icon.svg';
|
||||||
static const String iconEdit = 'assets/icons/icon_edit_icon.svg';
|
static const String iconEdit = 'assets/icons/icon_edit_icon.svg';
|
||||||
static const String textFieldSearch = 'assets/icons/textfield_search_icon.svg';
|
static const String textFieldSearch =
|
||||||
|
'assets/icons/textfield_search_icon.svg';
|
||||||
static const String roundedAddIcon = 'assets/icons/rounded_add_icon.svg';
|
static const String roundedAddIcon = 'assets/icons/rounded_add_icon.svg';
|
||||||
static const String addIcon = 'assets/icons/add_icon.svg';
|
static const String addIcon = 'assets/icons/add_icon.svg';
|
||||||
static const String smartThermostatIcon = 'assets/icons/smart_thermostat_icon.svg';
|
static const String smartThermostatIcon =
|
||||||
|
'assets/icons/smart_thermostat_icon.svg';
|
||||||
static const String smartLightIcon = 'assets/icons/smart_light_icon.svg';
|
static const String smartLightIcon = 'assets/icons/smart_light_icon.svg';
|
||||||
static const String presenceSensor = 'assets/icons/presence_sensor.svg';
|
static const String presenceSensor = 'assets/icons/presence_sensor.svg';
|
||||||
static const String Gang3SwitchIcon = 'assets/icons/3_Gang_switch_icon.svg';
|
static const String Gang3SwitchIcon = 'assets/icons/3_Gang_switch_icon.svg';
|
||||||
@@ -209,7 +219,8 @@ class Assets {
|
|||||||
//assets/icons/water_leak_normal.svg
|
//assets/icons/water_leak_normal.svg
|
||||||
static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg';
|
static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg';
|
||||||
//assets/icons/water_leak_detected.svg
|
//assets/icons/water_leak_detected.svg
|
||||||
static const String waterLeakDetected = 'assets/icons/water_leak_detected.svg';
|
static const String waterLeakDetected =
|
||||||
|
'assets/icons/water_leak_detected.svg';
|
||||||
|
|
||||||
//assets/icons/automation_records.svg
|
//assets/icons/automation_records.svg
|
||||||
static const String automationRecords = 'assets/icons/automation_records.svg';
|
static const String automationRecords = 'assets/icons/automation_records.svg';
|
||||||
@@ -280,13 +291,16 @@ class Assets {
|
|||||||
'assets/icons/functions_icons/sensitivity.svg';
|
'assets/icons/functions_icons/sensitivity.svg';
|
||||||
static const String assetsSensitivityOperationIcon =
|
static const String assetsSensitivityOperationIcon =
|
||||||
'assets/icons/functions_icons/sesitivity_operation_icon.svg';
|
'assets/icons/functions_icons/sesitivity_operation_icon.svg';
|
||||||
static const String assetsAcPower = 'assets/icons/functions_icons/ac_power.svg';
|
static const String assetsAcPower =
|
||||||
|
'assets/icons/functions_icons/ac_power.svg';
|
||||||
static const String assetsAcPowerOFF =
|
static const String assetsAcPowerOFF =
|
||||||
'assets/icons/functions_icons/ac_power_off.svg';
|
'assets/icons/functions_icons/ac_power_off.svg';
|
||||||
static const String assetsChildLock =
|
static const String assetsChildLock =
|
||||||
'assets/icons/functions_icons/child_lock.svg';
|
'assets/icons/functions_icons/child_lock.svg';
|
||||||
static const String assetsFreezing = 'assets/icons/functions_icons/freezing.svg';
|
static const String assetsFreezing =
|
||||||
static const String assetsFanSpeed = 'assets/icons/functions_icons/fan_speed.svg';
|
'assets/icons/functions_icons/freezing.svg';
|
||||||
|
static const String assetsFanSpeed =
|
||||||
|
'assets/icons/functions_icons/fan_speed.svg';
|
||||||
static const String assetsAcCooling =
|
static const String assetsAcCooling =
|
||||||
'assets/icons/functions_icons/ac_cooling.svg';
|
'assets/icons/functions_icons/ac_cooling.svg';
|
||||||
static const String assetsAcHeating =
|
static const String assetsAcHeating =
|
||||||
@@ -295,7 +309,8 @@ class Assets {
|
|||||||
'assets/icons/functions_icons/celsius_degrees.svg';
|
'assets/icons/functions_icons/celsius_degrees.svg';
|
||||||
static const String assetsTempreture =
|
static const String assetsTempreture =
|
||||||
'assets/icons/functions_icons/tempreture.svg';
|
'assets/icons/functions_icons/tempreture.svg';
|
||||||
static const String assetsAcFanLow = 'assets/icons/functions_icons/ac_fan_low.svg';
|
static const String assetsAcFanLow =
|
||||||
|
'assets/icons/functions_icons/ac_fan_low.svg';
|
||||||
static const String assetsAcFanMiddle =
|
static const String assetsAcFanMiddle =
|
||||||
'assets/icons/functions_icons/ac_fan_middle.svg';
|
'assets/icons/functions_icons/ac_fan_middle.svg';
|
||||||
static const String assetsAcFanHigh =
|
static const String assetsAcFanHigh =
|
||||||
@@ -314,7 +329,8 @@ class Assets {
|
|||||||
'assets/icons/functions_icons/far_detection.svg';
|
'assets/icons/functions_icons/far_detection.svg';
|
||||||
static const String assetsFarDetectionFunction =
|
static const String assetsFarDetectionFunction =
|
||||||
'assets/icons/functions_icons/far_detection_function.svg';
|
'assets/icons/functions_icons/far_detection_function.svg';
|
||||||
static const String assetsIndicator = 'assets/icons/functions_icons/indicator.svg';
|
static const String assetsIndicator =
|
||||||
|
'assets/icons/functions_icons/indicator.svg';
|
||||||
static const String assetsMotionDetection =
|
static const String assetsMotionDetection =
|
||||||
'assets/icons/functions_icons/motion_detection.svg';
|
'assets/icons/functions_icons/motion_detection.svg';
|
||||||
static const String assetsMotionlessDetection =
|
static const String assetsMotionlessDetection =
|
||||||
@@ -327,7 +343,8 @@ class Assets {
|
|||||||
'assets/icons/functions_icons/master_state.svg';
|
'assets/icons/functions_icons/master_state.svg';
|
||||||
static const String assetsSwitchAlarmSound =
|
static const String assetsSwitchAlarmSound =
|
||||||
'assets/icons/functions_icons/switch_alarm_sound.svg';
|
'assets/icons/functions_icons/switch_alarm_sound.svg';
|
||||||
static const String assetsResetOff = 'assets/icons/functions_icons/reset_off.svg';
|
static const String assetsResetOff =
|
||||||
|
'assets/icons/functions_icons/reset_off.svg';
|
||||||
|
|
||||||
// Assets for automation_functions
|
// Assets for automation_functions
|
||||||
static const String assetsCardUnlock =
|
static const String assetsCardUnlock =
|
||||||
@@ -371,13 +388,15 @@ class Assets {
|
|||||||
static const String activeUser = 'assets/icons/active_user.svg';
|
static const String activeUser = 'assets/icons/active_user.svg';
|
||||||
static const String deActiveUser = 'assets/icons/deactive_user.svg';
|
static const String deActiveUser = 'assets/icons/deactive_user.svg';
|
||||||
static const String invitedIcon = 'assets/icons/invited_icon.svg';
|
static const String invitedIcon = 'assets/icons/invited_icon.svg';
|
||||||
static const String rectangleCheckBox = 'assets/icons/rectangle_check_box.png';
|
static const String rectangleCheckBox =
|
||||||
|
'assets/icons/rectangle_check_box.png';
|
||||||
static const String CheckBoxChecked = 'assets/icons/box_checked.png';
|
static const String CheckBoxChecked = 'assets/icons/box_checked.png';
|
||||||
static const String emptyBox = 'assets/icons/empty_box.png';
|
static const String emptyBox = 'assets/icons/empty_box.png';
|
||||||
static const String completeProcessIcon =
|
static const String completeProcessIcon =
|
||||||
'assets/icons/compleate_process_icon.svg';
|
'assets/icons/compleate_process_icon.svg';
|
||||||
static const String completedDoneIcon = 'assets/images/completed_done.svg';
|
static const String completedDoneIcon = 'assets/images/completed_done.svg';
|
||||||
static const String currentProcessIcon = 'assets/icons/current_process_icon.svg';
|
static const String currentProcessIcon =
|
||||||
|
'assets/icons/current_process_icon.svg';
|
||||||
static const String uncomplete_ProcessIcon =
|
static const String uncomplete_ProcessIcon =
|
||||||
'assets/icons/uncompleate_process_icon.svg';
|
'assets/icons/uncompleate_process_icon.svg';
|
||||||
static const String wrongProcessIcon = 'assets/icons/wrong_process_icon.svg';
|
static const String wrongProcessIcon = 'assets/icons/wrong_process_icon.svg';
|
||||||
@@ -398,9 +417,11 @@ class Assets {
|
|||||||
static const String successIcon = 'assets/icons/success_icon.svg';
|
static const String successIcon = 'assets/icons/success_icon.svg';
|
||||||
static const String spaceLocationIcon = 'assets/icons/spaseLocationIcon.svg';
|
static const String spaceLocationIcon = 'assets/icons/spaseLocationIcon.svg';
|
||||||
static const String scenesPlayIcon = 'assets/icons/scenesPlayIcon.png';
|
static const String scenesPlayIcon = 'assets/icons/scenesPlayIcon.png';
|
||||||
static const String scenesPlayIconCheck = 'assets/icons/scenesPlayIconCheck.png';
|
static const String scenesPlayIconCheck =
|
||||||
|
'assets/icons/scenesPlayIconCheck.png';
|
||||||
static const String presenceStateIcon = 'assets/icons/presence_state.svg';
|
static const String presenceStateIcon = 'assets/icons/presence_state.svg';
|
||||||
static const String currentDistanceIcon = 'assets/icons/current_distance_icon.svg';
|
static const String currentDistanceIcon =
|
||||||
|
'assets/icons/current_distance_icon.svg';
|
||||||
|
|
||||||
static const String farDetectionIcon = 'assets/icons/far_detection_icon.svg';
|
static const String farDetectionIcon = 'assets/icons/far_detection_icon.svg';
|
||||||
static const String motionDetectionSensitivityIcon =
|
static const String motionDetectionSensitivityIcon =
|
||||||
@@ -423,29 +444,44 @@ class Assets {
|
|||||||
static const String cpsMode4 = 'assets/icons/cps_mode4.svg';
|
static const String cpsMode4 = 'assets/icons/cps_mode4.svg';
|
||||||
static const String closeToMotion = 'assets/icons/close_to_motion.svg';
|
static const String closeToMotion = 'assets/icons/close_to_motion.svg';
|
||||||
static const String farAwayMotion = 'assets/icons/far_away_motion.svg';
|
static const String farAwayMotion = 'assets/icons/far_away_motion.svg';
|
||||||
static const String communicationFault = 'assets/icons/communication_fault.svg';
|
static const String communicationFault =
|
||||||
|
'assets/icons/communication_fault.svg';
|
||||||
static const String radarFault = 'assets/icons/radar_fault.svg';
|
static const String radarFault = 'assets/icons/radar_fault.svg';
|
||||||
static const String selfTestingSuccess = 'assets/icons/self_testing_success.svg';
|
static const String selfTestingSuccess =
|
||||||
static const String selfTestingFailure = 'assets/icons/self_testing_failure.svg';
|
'assets/icons/self_testing_success.svg';
|
||||||
static const String selfTestingTimeout = 'assets/icons/self_testing_timeout.svg';
|
static const String selfTestingFailure =
|
||||||
|
'assets/icons/self_testing_failure.svg';
|
||||||
|
static const String selfTestingTimeout =
|
||||||
|
'assets/icons/self_testing_timeout.svg';
|
||||||
static const String movingSpeed = 'assets/icons/moving_speed.svg';
|
static const String movingSpeed = 'assets/icons/moving_speed.svg';
|
||||||
static const String boundary = 'assets/icons/boundary.svg';
|
static const String boundary = 'assets/icons/boundary.svg';
|
||||||
static const String motionMeter = 'assets/icons/motion_meter.svg';
|
static const String motionMeter = 'assets/icons/motion_meter.svg';
|
||||||
static const String spatialStaticValue = 'assets/icons/spatial_static_value.svg';
|
static const String spatialStaticValue =
|
||||||
static const String spatialMotionValue = 'assets/icons/spatial_motion_value.svg';
|
'assets/icons/spatial_static_value.svg';
|
||||||
|
static const String spatialMotionValue =
|
||||||
|
'assets/icons/spatial_motion_value.svg';
|
||||||
static const String presenceJudgementThrshold =
|
static const String presenceJudgementThrshold =
|
||||||
'assets/icons/presence_judgement_threshold.svg';
|
'assets/icons/presence_judgement_threshold.svg';
|
||||||
static const String spaceType = 'assets/icons/space_type.svg';
|
static const String spaceType = 'assets/icons/space_type.svg';
|
||||||
static const String sportsPara = 'assets/icons/sports_para.svg';
|
static const String sportsPara = 'assets/icons/sports_para.svg';
|
||||||
static const String sensitivityFeature1 = 'assets/icons/sensitivity_feature_1.svg';
|
static const String sensitivityFeature1 =
|
||||||
static const String sensitivityFeature2 = 'assets/icons/sensitivity_feature_2.svg';
|
'assets/icons/sensitivity_feature_1.svg';
|
||||||
static const String sensitivityFeature3 = 'assets/icons/sensitivity_feature_3.svg';
|
static const String sensitivityFeature2 =
|
||||||
static const String sensitivityFeature4 = 'assets/icons/sensitivity_feature_4.svg';
|
'assets/icons/sensitivity_feature_2.svg';
|
||||||
static const String sensitivityFeature5 = 'assets/icons/sensitivity_feature_5.svg';
|
static const String sensitivityFeature3 =
|
||||||
static const String sensitivityFeature6 = 'assets/icons/sensitivity_feature_6.svg';
|
'assets/icons/sensitivity_feature_3.svg';
|
||||||
static const String sensitivityFeature7 = 'assets/icons/sensitivity_feature_7.svg';
|
static const String sensitivityFeature4 =
|
||||||
static const String sensitivityFeature8 = 'assets/icons/sensitivity_feature_8.svg';
|
'assets/icons/sensitivity_feature_4.svg';
|
||||||
static const String sensitivityFeature9 = 'assets/icons/sensitivity_feature_9.svg';
|
static const String sensitivityFeature5 =
|
||||||
|
'assets/icons/sensitivity_feature_5.svg';
|
||||||
|
static const String sensitivityFeature6 =
|
||||||
|
'assets/icons/sensitivity_feature_6.svg';
|
||||||
|
static const String sensitivityFeature7 =
|
||||||
|
'assets/icons/sensitivity_feature_7.svg';
|
||||||
|
static const String sensitivityFeature8 =
|
||||||
|
'assets/icons/sensitivity_feature_8.svg';
|
||||||
|
static const String sensitivityFeature9 =
|
||||||
|
'assets/icons/sensitivity_feature_9.svg';
|
||||||
static const String deviceTagIcon = 'assets/icons/device_tag_ic.svg';
|
static const String deviceTagIcon = 'assets/icons/device_tag_ic.svg';
|
||||||
static const String targetConfirmTimeIcon =
|
static const String targetConfirmTimeIcon =
|
||||||
'assets/icons/target_confirm_time_icon.svg';
|
'assets/icons/target_confirm_time_icon.svg';
|
||||||
@@ -453,10 +489,13 @@ class Assets {
|
|||||||
static const String indentLevelIcon = 'assets/icons/indent_level_icon.svg';
|
static const String indentLevelIcon = 'assets/icons/indent_level_icon.svg';
|
||||||
static const String triggerLevelIcon = 'assets/icons/trigger_level_icon.svg';
|
static const String triggerLevelIcon = 'assets/icons/trigger_level_icon.svg';
|
||||||
static const String blankCalendar = 'assets/icons/blank_calendar.svg';
|
static const String blankCalendar = 'assets/icons/blank_calendar.svg';
|
||||||
static const String refreshStatusIcon = 'assets/icons/refresh_status_icon.svg';
|
static const String refreshStatusIcon =
|
||||||
static const String energyConsumedIcon = 'assets/icons/energy_consumed_icon.svg';
|
'assets/icons/refresh_status_icon.svg';
|
||||||
|
static const String energyConsumedIcon =
|
||||||
|
'assets/icons/energy_consumed_icon.svg';
|
||||||
|
|
||||||
static const String closeSettingsIcon = 'assets/icons/close_settings_icon.svg';
|
static const String closeSettingsIcon =
|
||||||
|
'assets/icons/close_settings_icon.svg';
|
||||||
|
|
||||||
static const String editNameIconSettings =
|
static const String editNameIconSettings =
|
||||||
'assets/icons/edit_name_icon_settings.svg';
|
'assets/icons/edit_name_icon_settings.svg';
|
||||||
@@ -469,11 +508,4 @@ class Assets {
|
|||||||
static const String humidityAqiSidebar = 'assets/icons/humidity.svg';
|
static const String humidityAqiSidebar = 'assets/icons/humidity.svg';
|
||||||
static const String autocadOccupancyImage =
|
static const String autocadOccupancyImage =
|
||||||
'assets/images/autocad_occupancy_image.png';
|
'assets/images/autocad_occupancy_image.png';
|
||||||
static const String emptyBarredChart = 'assets/icons/empty_barred_chart.svg';
|
|
||||||
static const String emptyEnergyManagementChart =
|
|
||||||
'assets/icons/empty_energy_management_chart.svg';
|
|
||||||
static const String emptyEnergyManagementPerDevice =
|
|
||||||
'assets/icons/empty_energy_management_per_device.svg';
|
|
||||||
static const String emptyHeatmap = 'assets/icons/empty_heatmap.svg';
|
|
||||||
static const String emptyRangeOfAqi = 'assets/icons/empty_range_of_aqi.svg';
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user