mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 10:24:53 +00:00
add settings to flush sensor
This commit is contained in:
@ -22,6 +22,7 @@ class FlushSensorBloc extends Bloc<FlushSensorEvent, FlushSensorState> {
|
||||
on<FlushSensorChangeValueEvent>(_changeValue);
|
||||
on<FlushSensorUpdatedEvent>(_flushSensorUpdated);
|
||||
on<FlushSensorGetDeviceReportsEvent>(_getDeviceReports);
|
||||
on<FlushSensorInitialDeviseInfo>(fetchDeviceInfo);
|
||||
}
|
||||
|
||||
void _fetchFlushSensorStatus(
|
||||
@ -128,5 +129,50 @@ class FlushSensorBloc extends Bloc<FlushSensorEvent, FlushSensorState> {
|
||||
}
|
||||
}
|
||||
|
||||
DeviceInfoModel deviceInfo = DeviceInfoModel(
|
||||
activeTime: 0,
|
||||
category: "",
|
||||
categoryName: "",
|
||||
createTime: 0,
|
||||
gatewayId: "",
|
||||
icon: "",
|
||||
ip: "",
|
||||
lat: "",
|
||||
localKey: "",
|
||||
lon: "",
|
||||
model: "",
|
||||
name: "",
|
||||
nodeId: "",
|
||||
online: false,
|
||||
ownerId: "",
|
||||
productName: "",
|
||||
sub: false,
|
||||
timeZone: "",
|
||||
updateTime: 0,
|
||||
uuid: "",
|
||||
productUuid: "",
|
||||
productType: "",
|
||||
permissionType: "",
|
||||
macAddress: "",
|
||||
subspace: Subspace(
|
||||
uuid: "",
|
||||
createdAt: "",
|
||||
updatedAt: "",
|
||||
subspaceName: "",
|
||||
),
|
||||
);
|
||||
static String deviceName = '';
|
||||
|
||||
void fetchDeviceInfo(FlushSensorInitialDeviseInfo event,
|
||||
Emitter<FlushSensorState> emit) async {
|
||||
try {
|
||||
emit(FlushSensorLoadingInitialState());
|
||||
var response = await DevicesAPI.getDeviceInfo(deviceId);
|
||||
deviceInfo = DeviceInfoModel.fromJson(response);
|
||||
deviceName = deviceInfo.name;
|
||||
emit(FlushSensorLoadingDeviceInfo(deviceInfo: deviceInfo));
|
||||
} catch (e) {
|
||||
emit(FlushSensorFailedState(error: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,24 @@ class FlushMountedInterface extends StatelessWidget {
|
||||
),
|
||||
child: DefaultScaffold(
|
||||
title: deviceModel.name!,
|
||||
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
var val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
SettingsPage(device: deviceModel),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
bloc.add(FlushSensorInitialDeviseInfo());
|
||||
bloc.add(FlushSensorInitialEvent());
|
||||
}
|
||||
},
|
||||
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
|
||||
Reference in New Issue
Block a user