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