GazeInfo constructor
GazeInfo(
- Map event
Implementation
GazeInfo(Map<dynamic, dynamic> event) {
final double x = event[MetricsInfoKey.gazeX.name] ?? -1001;
final double y = event[MetricsInfoKey.gazeY.name] ?? -1001;
gaze = Point(x, y);
var fixationX = event[MetricsInfoKey.fixationX.name] ?? -1001;
var fixationY = event[MetricsInfoKey.fixationY.name] ?? -1001;
fixation = Point(fixationX, fixationY);
final trackingValue = event[MetricsInfoKey.trackingState.name] ?? "";
if (trackingValue == "SUCCESS") {
trackingState = TrackingState.success;
} else if (trackingValue == "GAZE_NOT_FOUND") {
trackingState = TrackingState.gazeNotFound;
} else {
trackingState = TrackingState.faceMissing;
}
final movenmentValue = event[MetricsInfoKey.eyeMovementState.name] ?? "";
if (movenmentValue == "FIXATION") {
eyemovementState = EyemovementState.fixation;
} else if (movenmentValue == "SACCADE") {
eyemovementState = EyemovementState.saccade;
} else {
eyemovementState = EyemovementState.unknown;
}
final screenValue = event[MetricsInfoKey.screenState.name] ?? "";
if (screenValue == "INSIDE_OF_SCREEN") {
screenState = ScreenState.insideOfScreen;
} else if (screenValue == "OUTSIDE_OF_SCREEN") {
screenState = ScreenState.outsideOfScreen;
} else {
screenState = ScreenState.unknown;
}
}