getCameraStatus static method
- CameraName name
An icon to indicate the status of the given camera.
Implementation
static Widget getCameraStatus(CameraName name) {
if (!models.sockets.video.isConnected) {
return Icon(Icons.signal_wifi_off, color: Colors.black.withOpacity(0.5));
}
final status = models.video.feeds[name]!.details.status;
const size = 12.0;
return switch (status) {
CameraStatus.CAMERA_STATUS_UNDEFINED =>
const Icon(Icons.question_mark, size: size),
CameraStatus.CAMERA_DISCONNECTED =>
const Icon(Icons.circle, size: size, color: Colors.black),
CameraStatus.CAMERA_ENABLED =>
const Icon(Icons.circle, size: size, color: Colors.green),
CameraStatus.CAMERA_LOADING =>
const Icon(Icons.circle, size: size, color: Colors.blueGrey),
CameraStatus.CAMERA_DISABLED =>
const Icon(Icons.circle, size: size, color: Colors.orange),
CameraStatus.CAMERA_NOT_RESPONDING =>
const Icon(Icons.circle, size: size, color: Colors.red),
CameraStatus.FRAME_TOO_LARGE =>
const Icon(Icons.circle, size: size, color: Colors.orange),
CameraStatus.CAMERA_HAS_NO_NAME =>
const Icon(Icons.circle, size: size, color: Colors.black),
_ => throw ArgumentError("Unrecognized status: $status"),
};
}