mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-14 09:17:37 +00:00
handle Lux description for illumnance sensor
This commit is contained in:
@ -58,7 +58,7 @@ class ReportsTable extends StatelessWidget {
|
|||||||
TableCellWidget(value: date),
|
TableCellWidget(value: date),
|
||||||
TableCellWidget(value: time),
|
TableCellWidget(value: time),
|
||||||
TableCellWidget(
|
TableCellWidget(
|
||||||
value: '${data.value!} $thirdColumnDescription',
|
value: '${data.value!} ${thirdColumnDescription ?? ''}',
|
||||||
onTap: () => onRowTap(index),
|
onTap: () => onRowTap(index),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -99,7 +99,7 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
|||||||
try {
|
try {
|
||||||
await DevicesManagementApi.getDeviceReports(deviceId, event.code)
|
await DevicesManagementApi.getDeviceReports(deviceId, event.code)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
emit(DeviceReportsState(deviceReport: value));
|
emit(DeviceReportsState(deviceReport: value, code:event.code));
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(DeviceReportsFailedState(error: e.toString()));
|
emit(DeviceReportsFailedState(error: e.toString()));
|
||||||
|
@ -42,7 +42,8 @@ class DeviceReportsLoadingState extends WallSensorState {}
|
|||||||
|
|
||||||
class DeviceReportsState extends WallSensorState {
|
class DeviceReportsState extends WallSensorState {
|
||||||
final DeviceReport deviceReport;
|
final DeviceReport deviceReport;
|
||||||
const DeviceReportsState({required this.deviceReport});
|
final String code;
|
||||||
|
const DeviceReportsState({required this.deviceReport, required this.code});
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeviceReportsFailedState extends WallSensorState {
|
class DeviceReportsFailedState extends WallSensorState {
|
||||||
|
@ -38,8 +38,10 @@ class WallSensorControls extends StatelessWidget with HelperResponsiveLayout {
|
|||||||
} else if (state is DeviceReportsState) {
|
} else if (state is DeviceReportsState) {
|
||||||
return ReportsTable(
|
return ReportsTable(
|
||||||
report: state.deviceReport,
|
report: state.deviceReport,
|
||||||
thirdColumnTitle: "Value",
|
thirdColumnTitle:
|
||||||
thirdColumnDescription: "Lux",
|
state.code == 'illuminance_value' ? "Value" : 'Status',
|
||||||
|
thirdColumnDescription:
|
||||||
|
state.code == 'illuminance_value' ? "Lux" : null,
|
||||||
onRowTap: (index) {},
|
onRowTap: (index) {},
|
||||||
onClose: () {
|
onClose: () {
|
||||||
context.read<WallSensorBloc>().add(BackToGridViewEvent());
|
context.read<WallSensorBloc>().add(BackToGridViewEvent());
|
||||||
|
Reference in New Issue
Block a user